From 3831138de3bdb243ed6688b3033d1c8097fe8c9d Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Fri, 2 Mar 2018 15:59:17 +0100 Subject: [PATCH] Extended success responses on 'LocalRecorder.upload...()' methods (2XX instead of 200) --- openvidu-browser/ts/OpenViduInternal/LocalRecorder.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/openvidu-browser/ts/OpenViduInternal/LocalRecorder.ts b/openvidu-browser/ts/OpenViduInternal/LocalRecorder.ts index 52331738..42f0069b 100644 --- a/openvidu-browser/ts/OpenViduInternal/LocalRecorder.ts +++ b/openvidu-browser/ts/OpenViduInternal/LocalRecorder.ts @@ -207,8 +207,9 @@ export class LocalRecorder { http.open("POST", endpoint, true); http.onreadystatechange = () => { if (http.readyState === 4) { - if (http.status === 200) { - resolve("File uploaded"); + if (http.status.toString().charAt(0) === '2') { + // Success response from server (HTTP status standard: 2XX is success) + resolve(http.responseText); } else { reject(Error("Upload error: " + http.status)); } @@ -233,8 +234,9 @@ export class LocalRecorder { http.onreadystatechange = () => { if (http.readyState === 4) { - if (http.status === 200) { - resolve("File uploaded"); + if (http.status.toString().charAt(0) === '2') { + // Success response from server (HTTP status standard: 2XX is success) + resolve(http.responseText); } else { reject(Error("Upload error: " + http.status)); }