diff --git a/docs/api.md b/docs/api.md index 45fcf442..e8599fc2 100644 --- a/docs/api.md +++ b/docs/api.md @@ -112,8 +112,6 @@ + [interceptedRequest.postData](#interceptedrequestpostdata) + [interceptedRequest.url](#interceptedrequesturl) * [class: Body](#class-body) - + [body.arrayBuffer()](#bodyarraybuffer) - + [body.bodyUsed](#bodybodyused) + [body.buffer()](#bodybuffer) + [body.json()](#bodyjson) + [body.text()](#bodytext) @@ -1031,12 +1029,6 @@ Contains `POST` data for `POST` requests. If changed, the request url will be modified in a way that's not observable by page. Must not be changed in response to an authChallenge. ### class: Body -#### body.arrayBuffer() -- returns: > - - -#### body.bodyUsed -- returns: <[boolean]> #### body.buffer() - returns: > @@ -1048,7 +1040,6 @@ If changed, the request url will be modified in a way that's not observable by p - returns: > [Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array" -[ArrayBuffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer "ArrayBuffer" [boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean" [Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer" [function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function" @@ -1070,4 +1061,4 @@ If changed, the request url will be modified in a way that's not observable by p [Dialog]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-dialog "Dialog" [Mouse]: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-mouse "Mouse" [Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map" -[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector" \ No newline at end of file +[selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector" diff --git a/lib/NetworkManager.js b/lib/NetworkManager.js index 7e997abe..4b704fca 100644 --- a/lib/NetworkManager.js +++ b/lib/NetworkManager.js @@ -156,13 +156,6 @@ class Body { return this._contentPromise; } - /** - * @return {boolean} - */ - get bodyUsed() { - return !!this._contentPromise; - } - /** * @return {!Promise} */ @@ -178,14 +171,6 @@ class Body { let content = await this.text(); return JSON.parse(content); } - - /** - * @return {!Promise} - */ - async arrayBuffer() { - let content = await this.buffer(); - return content.buffer; - } } helper.tracePublicAPI(Body); diff --git a/test/test.js b/test/test.js index ca51a7a2..a41f1a50 100644 --- a/test/test.js +++ b/test/test.js @@ -1071,10 +1071,8 @@ describe('Puppeteer', function() { page.on('request', r => request = r); await page.evaluate(() => fetch('./post', { method: 'POST', body: JSON.stringify({foo: 'bar'})})); expect(request).toBeTruthy(); - expect(request.bodyUsed).toBe(false); expect(await request.text()).toBe('{"foo":"bar"}'); expect(await request.json()).toEqual({foo: 'bar'}); - expect(request.bodyUsed).toBe(true); })); }); describe('Response implements Body', function() { @@ -1083,10 +1081,8 @@ describe('Puppeteer', function() { page.on('response', r => response = r); await page.navigate(PREFIX + '/simple.json'); expect(response).toBeTruthy(); - expect(response.bodyUsed).toBe(false); expect(await response.text()).toBe('{"foo": "bar"}\n'); expect(await response.json()).toEqual({foo: 'bar'}); - expect(response.bodyUsed).toBe(true); })); }); describe('Network Events', function() {