We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3ee0758 commit baae6a8Copy full SHA for baae6a8
src/ajax.ts
@@ -2,6 +2,13 @@ import { Events } from '@playcanvas/observer';
2
3
import { globals as api } from './globals';
4
5
+const SUCCESS_CODES = [
6
+ 200, // OK
7
+ 201, // Created
8
+ 202, // Accepted
9
+ 204 // No Content
10
+];
11
+
12
type AjaxArgs = {
13
// The URL to make the request to.
14
url: string;
@@ -144,7 +151,7 @@ class Ajax<T> extends Events {
144
151
this._progress = 1;
145
152
this.emit('progress', 1);
146
153
147
- if (this._xhr.status === 200 || this._xhr.status === 201) {
154
+ if (SUCCESS_CODES.includes(this._xhr.status)) {
148
155
if (this._notJson) {
149
156
this.emit('load', this._xhr.status, this._xhr.responseText);
150
157
} else {
0 commit comments