Extended success responses on 'LocalRecorder.upload...()' methods (2XX instead of 200)

pull/32/head
pabloFuente 2018-03-02 15:59:17 +01:00
parent 5e756e9a97
commit 3831138de3
1 changed files with 6 additions and 4 deletions

View File

@ -207,8 +207,9 @@ export class LocalRecorder {
http.open("POST", endpoint, true); http.open("POST", endpoint, true);
http.onreadystatechange = () => { http.onreadystatechange = () => {
if (http.readyState === 4) { if (http.readyState === 4) {
if (http.status === 200) { if (http.status.toString().charAt(0) === '2') {
resolve("File uploaded"); // Success response from server (HTTP status standard: 2XX is success)
resolve(http.responseText);
} else { } else {
reject(Error("Upload error: " + http.status)); reject(Error("Upload error: " + http.status));
} }
@ -233,8 +234,9 @@ export class LocalRecorder {
http.onreadystatechange = () => { http.onreadystatechange = () => {
if (http.readyState === 4) { if (http.readyState === 4) {
if (http.status === 200) { if (http.status.toString().charAt(0) === '2') {
resolve("File uploaded"); // Success response from server (HTTP status standard: 2XX is success)
resolve(http.responseText);
} else { } else {
reject(Error("Upload error: " + http.status)); reject(Error("Upload error: " + http.status));
} }