@mswjs/interceptors
Advanced tools
Comparing version 0.17.0 to 0.17.1
@@ -14,3 +14,3 @@ import { Headers } from 'headers-polyfill/lib'; | ||
readonly credentials: RequestCredentials; | ||
private readonly body; | ||
private readonly _body; | ||
private _bodyUsed; | ||
@@ -17,0 +17,0 @@ constructor(url: URL); |
@@ -55,3 +55,3 @@ "use strict"; | ||
this.credentials = input.credentials; | ||
this.body = input.body || defaultBody; | ||
this._body = input._body || defaultBody; | ||
return; | ||
@@ -64,3 +64,3 @@ } | ||
this.credentials = init.credentials || 'same-origin'; | ||
this.body = init.body || defaultBody; | ||
this._body = init.body || defaultBody; | ||
} | ||
@@ -79,3 +79,3 @@ Object.defineProperty(IsomorphicRequest.prototype, "bodyUsed", { | ||
this._bodyUsed = true; | ||
return [2 /*return*/, bufferUtils_1.decodeBuffer(this.body)]; | ||
return [2 /*return*/, bufferUtils_1.decodeBuffer(this._body)]; | ||
}); | ||
@@ -90,3 +90,3 @@ }); | ||
this._bodyUsed = true; | ||
text = bufferUtils_1.decodeBuffer(this.body); | ||
text = bufferUtils_1.decodeBuffer(this._body); | ||
return [2 /*return*/, JSON.parse(text)]; | ||
@@ -101,3 +101,3 @@ }); | ||
this._bodyUsed = true; | ||
return [2 /*return*/, this.body]; | ||
return [2 /*return*/, this._body]; | ||
}); | ||
@@ -104,0 +104,0 @@ }); |
{ | ||
"name": "@mswjs/interceptors", | ||
"description": "Low-level HTTP/HTTPS/XHR/fetch request interception library.", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "typings": "lib/index.d.ts", |
@@ -85,3 +85,3 @@ import { Headers } from 'headers-polyfill/lib' | ||
expect(request.url.href).toBe(derivedRequest.url.href) | ||
expect(request['body']).toEqual(derivedRequest['body']) | ||
expect(request['_body']).toEqual(derivedRequest['_body']) | ||
expect(request.headers).toEqual(derivedRequest.headers) | ||
@@ -93,3 +93,3 @@ expect(request.method).toBe(derivedRequest.method) | ||
it('clones current isomorphic request instance', async () => { | ||
it('clones current isomorphic request instance', () => { | ||
const request = new IsomorphicRequest(url, { | ||
@@ -99,4 +99,2 @@ body, | ||
}) | ||
await request.text() | ||
const clonedRequest = request.clone() | ||
@@ -109,4 +107,4 @@ | ||
expect(clonedRequest.credentials).toBe(request.credentials) | ||
expect(clonedRequest['body']).toEqual(request['body']) | ||
expect(clonedRequest['_body']).toEqual(request['_body']) | ||
expect(clonedRequest.bodyUsed).toBe(false) | ||
}) |
@@ -20,3 +20,3 @@ import { Headers } from 'headers-polyfill/lib' | ||
private readonly body: ArrayBuffer | ||
private readonly _body: ArrayBuffer | ||
private _bodyUsed: boolean | ||
@@ -37,3 +37,3 @@ | ||
this.credentials = input.credentials | ||
this.body = input.body || defaultBody | ||
this._body = input._body || defaultBody | ||
return | ||
@@ -47,3 +47,3 @@ } | ||
this.credentials = init.credentials || 'same-origin' | ||
this.body = init.body || defaultBody | ||
this._body = init.body || defaultBody | ||
} | ||
@@ -62,3 +62,3 @@ | ||
this._bodyUsed = true | ||
return decodeBuffer(this.body) | ||
return decodeBuffer(this._body) | ||
} | ||
@@ -73,3 +73,3 @@ | ||
this._bodyUsed = true | ||
const text = decodeBuffer(this.body) | ||
const text = decodeBuffer(this._body) | ||
return JSON.parse(text) | ||
@@ -85,3 +85,3 @@ } | ||
this._bodyUsed = true | ||
return this.body | ||
return this._body | ||
} | ||
@@ -88,0 +88,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
404908
7756