mphttpx 1.2.0-beta.2 → 1.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/HeadersP.js +8 -0
- package/dist/cjs/RequestP.js +2 -10
- package/dist/cjs/XMLHttpRequestP.js +5 -9
- package/dist/cjs/fetchP.js +1 -1
- package/dist/esm/HeadersP.js +8 -1
- package/dist/esm/RequestP.js +2 -9
- package/dist/esm/XMLHttpRequestP.js +4 -8
- package/dist/esm/fetchP.js +1 -1
- package/package.json +1 -1
package/dist/cjs/HeadersP.js
CHANGED
|
@@ -167,10 +167,18 @@ function parseHeaders(rawHeaders) {
|
|
|
167
167
|
});
|
|
168
168
|
return headers;
|
|
169
169
|
}
|
|
170
|
+
// HTTP methods whose capitalization should be normalized
|
|
171
|
+
const methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
172
|
+
/** @internal */
|
|
173
|
+
function normalizeMethod(method) {
|
|
174
|
+
let upcased = method.toUpperCase();
|
|
175
|
+
return methods.indexOf(upcased) > -1 ? upcased : method;
|
|
176
|
+
}
|
|
170
177
|
const HeadersE = isPolyfill.g["Headers"] || HeadersP;
|
|
171
178
|
|
|
172
179
|
exports.Headers = HeadersE;
|
|
173
180
|
exports.HeadersP = HeadersP;
|
|
181
|
+
exports.normalizeMethod = normalizeMethod;
|
|
174
182
|
exports.normalizeName = normalizeName;
|
|
175
183
|
exports.normalizeValue = normalizeValue;
|
|
176
184
|
exports.parseHeaders = parseHeaders;
|
package/dist/cjs/RequestP.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var HeadersP = require('./HeadersP.js');
|
|
4
3
|
var AbortControllerP = require('./AbortControllerP.js');
|
|
4
|
+
var HeadersP = require('./HeadersP.js');
|
|
5
5
|
var isPolyfill = require('./isPolyfill.js');
|
|
6
6
|
var BodyImpl = require('./BodyImpl.js');
|
|
7
7
|
require('./AbortSignalP.js');
|
|
@@ -63,7 +63,7 @@ class RequestP extends BodyImpl.BodyImpl {
|
|
|
63
63
|
s.headers = new HeadersP.HeadersP(_init.headers);
|
|
64
64
|
}
|
|
65
65
|
if (_init.method) {
|
|
66
|
-
s.method = normalizeMethod(_init.method);
|
|
66
|
+
s.method = HeadersP.normalizeMethod(_init.method);
|
|
67
67
|
}
|
|
68
68
|
if (_init.mode) {
|
|
69
69
|
s.mode = _init.mode;
|
|
@@ -143,16 +143,8 @@ class RequestState {
|
|
|
143
143
|
this.url = "";
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
// HTTP methods whose capitalization should be normalized
|
|
147
|
-
const methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
148
|
-
/** @internal */
|
|
149
|
-
function normalizeMethod(method) {
|
|
150
|
-
let upcased = method.toUpperCase();
|
|
151
|
-
return methods.indexOf(upcased) > -1 ? upcased : method;
|
|
152
|
-
}
|
|
153
146
|
const RequestE = isPolyfill.g["Request"] || RequestP;
|
|
154
147
|
|
|
155
148
|
exports.Request = RequestE;
|
|
156
149
|
exports.RequestP = RequestP;
|
|
157
|
-
exports.normalizeMethod = normalizeMethod;
|
|
158
150
|
exports.requestState = state;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var HeadersP = require('./HeadersP.js');
|
|
4
|
-
var BlobP = require('./BlobP.js');
|
|
5
3
|
var convertor = require('./convertor.js');
|
|
6
|
-
var
|
|
4
|
+
var BlobP = require('./BlobP.js');
|
|
5
|
+
var HeadersP = require('./HeadersP.js');
|
|
7
6
|
var EventTargetP = require('./EventTargetP.js');
|
|
8
7
|
var EventP = require('./EventP.js');
|
|
9
8
|
var ProgressEventP = require('./ProgressEventP.js');
|
|
10
9
|
var platform = require('./platform.js');
|
|
11
10
|
var isPolyfill = require('./isPolyfill.js');
|
|
12
|
-
require('./TextEncoderP.js');
|
|
13
|
-
require('./TextDecoderP.js');
|
|
14
11
|
require('./FormDataP.js');
|
|
15
12
|
require('./FileP.js');
|
|
16
|
-
require('./
|
|
17
|
-
require('./
|
|
18
|
-
require('./BodyImpl.js');
|
|
13
|
+
require('./TextEncoderP.js');
|
|
14
|
+
require('./TextDecoderP.js');
|
|
19
15
|
|
|
20
16
|
const request = platform.mp ? platform.mp.request : function errorRequest(options) {
|
|
21
17
|
const errMsg = "NOT_SUPPORTED_ERR";
|
|
@@ -273,7 +269,7 @@ class XMLHttpRequestImpl extends XMLHttpRequestEventTargetP {
|
|
|
273
269
|
}
|
|
274
270
|
const s = this[state];
|
|
275
271
|
clearRequest(this, false);
|
|
276
|
-
s[_method] =
|
|
272
|
+
s[_method] = HeadersP.normalizeMethod(method);
|
|
277
273
|
s[_requestURL] = "" + url;
|
|
278
274
|
if (username !== null || password !== null) {
|
|
279
275
|
let _username = "" + (username !== null && username !== void 0 ? username : "");
|
package/dist/cjs/fetchP.js
CHANGED
|
@@ -6,10 +6,10 @@ var BodyImpl = require('./BodyImpl.js');
|
|
|
6
6
|
var RequestP = require('./RequestP.js');
|
|
7
7
|
var ResponseP = require('./ResponseP.js');
|
|
8
8
|
var isPolyfill = require('./isPolyfill.js');
|
|
9
|
+
require('./convertor.js');
|
|
9
10
|
require('./BlobP.js');
|
|
10
11
|
require('./TextEncoderP.js');
|
|
11
12
|
require('./TextDecoderP.js');
|
|
12
|
-
require('./convertor.js');
|
|
13
13
|
require('./FormDataP.js');
|
|
14
14
|
require('./FileP.js');
|
|
15
15
|
require('./EventTargetP.js');
|
package/dist/esm/HeadersP.js
CHANGED
|
@@ -165,6 +165,13 @@ function parseHeaders(rawHeaders) {
|
|
|
165
165
|
});
|
|
166
166
|
return headers;
|
|
167
167
|
}
|
|
168
|
+
// HTTP methods whose capitalization should be normalized
|
|
169
|
+
const methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
170
|
+
/** @internal */
|
|
171
|
+
function normalizeMethod(method) {
|
|
172
|
+
let upcased = method.toUpperCase();
|
|
173
|
+
return methods.indexOf(upcased) > -1 ? upcased : method;
|
|
174
|
+
}
|
|
168
175
|
const HeadersE = g["Headers"] || HeadersP;
|
|
169
176
|
|
|
170
|
-
export { HeadersE as Headers, HeadersP, normalizeName, normalizeValue, parseHeaders };
|
|
177
|
+
export { HeadersE as Headers, HeadersP, normalizeMethod, normalizeName, normalizeValue, parseHeaders };
|
package/dist/esm/RequestP.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HeadersP } from './HeadersP.js';
|
|
2
1
|
import { AbortControllerP } from './AbortControllerP.js';
|
|
2
|
+
import { HeadersP, normalizeMethod } from './HeadersP.js';
|
|
3
3
|
import { g, checkArgsLength, isPolyfillType, polyfill } from './isPolyfill.js';
|
|
4
4
|
import { BodyImpl, bodyState as state$1, Body_toPayload, Body_init } from './BodyImpl.js';
|
|
5
5
|
import './AbortSignalP.js';
|
|
@@ -141,13 +141,6 @@ class RequestState {
|
|
|
141
141
|
this.url = "";
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
// HTTP methods whose capitalization should be normalized
|
|
145
|
-
const methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
|
|
146
|
-
/** @internal */
|
|
147
|
-
function normalizeMethod(method) {
|
|
148
|
-
let upcased = method.toUpperCase();
|
|
149
|
-
return methods.indexOf(upcased) > -1 ? upcased : method;
|
|
150
|
-
}
|
|
151
144
|
const RequestE = g["Request"] || RequestP;
|
|
152
145
|
|
|
153
|
-
export { RequestE as Request, RequestP,
|
|
146
|
+
export { RequestE as Request, RequestP, state as requestState };
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { HeadersP } from './HeadersP.js';
|
|
2
|
-
import { Uint8Array_toBase64, encode } from './BlobP.js';
|
|
3
1
|
import { convert, convertBack } from './convertor.js';
|
|
4
|
-
import {
|
|
2
|
+
import { Uint8Array_toBase64, encode } from './BlobP.js';
|
|
3
|
+
import { normalizeMethod, HeadersP } from './HeadersP.js';
|
|
5
4
|
import { EventTargetP, attachFn, executeFn, EventTargetState, eventTargetState as state$2, EventTarget_fire } from './EventTargetP.js';
|
|
6
5
|
import { createInnerEvent } from './EventP.js';
|
|
7
6
|
import { emitProcessEvent } from './ProgressEventP.js';
|
|
8
7
|
import { mp as mp$1 } from './platform.js';
|
|
9
8
|
import { polyfill, checkArgsLength, MPException } from './isPolyfill.js';
|
|
10
|
-
import './TextEncoderP.js';
|
|
11
|
-
import './TextDecoderP.js';
|
|
12
9
|
import './FormDataP.js';
|
|
13
10
|
import './FileP.js';
|
|
14
|
-
import './
|
|
15
|
-
import './
|
|
16
|
-
import './BodyImpl.js';
|
|
11
|
+
import './TextEncoderP.js';
|
|
12
|
+
import './TextDecoderP.js';
|
|
17
13
|
|
|
18
14
|
const request = mp$1 ? mp$1.request : function errorRequest(options) {
|
|
19
15
|
const errMsg = "NOT_SUPPORTED_ERR";
|
package/dist/esm/fetchP.js
CHANGED
|
@@ -4,10 +4,10 @@ import { Body_toPayload } from './BodyImpl.js';
|
|
|
4
4
|
import { RequestP, requestState as state } from './RequestP.js';
|
|
5
5
|
import { ResponseP, responseState as state$1 } from './ResponseP.js';
|
|
6
6
|
import { g, checkArgsLength, MPException, isObjectType, isPolyfillType } from './isPolyfill.js';
|
|
7
|
+
import './convertor.js';
|
|
7
8
|
import './BlobP.js';
|
|
8
9
|
import './TextEncoderP.js';
|
|
9
10
|
import './TextDecoderP.js';
|
|
10
|
-
import './convertor.js';
|
|
11
11
|
import './FormDataP.js';
|
|
12
12
|
import './FileP.js';
|
|
13
13
|
import './EventTargetP.js';
|