<titledata-rh="true">HTTPResponse class | Puppeteer</title><metadata-rh="true"name="viewport"content="width=device-width,initial-scale=1"><metadata-rh="true"name="twitter:card"content="summary_large_image"><metadata-rh="true"property="og:url"content="https://pptr.dev/api/puppeteer.httpresponse"><metadata-rh="true"property="og:locale"content="en"><metadata-rh="true"name="docsearch:language"content="en"><metadata-rh="true"name="docsearch:counter"content="2"><metadata-rh="true"property="og:title"content="HTTPResponse class | Puppeteer"><metadata-rh="true"name="description"content="The HTTPResponse class represents responses which are received by the Page class."><metadata-rh="true"property="og:description"content="The HTTPResponse class represents responses which are received by the Page class."><linkdata-rh="true"rel="icon"href="/img/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://pptr.dev/api/puppeteer.httpresponse"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/api/puppeteer.httpresponse"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/api/puppeteer.httpresponse"hreflang="x-default"><linkdata-rh="true"rel="preconnect"href="https://DVKY664LG7-dsn.algolia.net"crossorigin="anonymous"><linkrel="search"type="application/opensearchdescription+xml"title="Puppeteer"href="/opensearch.xml">
<h4class="anchor anchorWithStickyNavbar_FNw8"id="signature">Signature:<ahref="#signature"class="hash-link"aria-label="Direct link to Signature:"title="Direct link to Signature:"></a></h4>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="remarks">Remarks<ahref="#remarks"class="hash-link"aria-label="Direct link to Remarks"title="Direct link to Remarks"></a></h2>
<p>The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the <code>HTTPResponse</code> class.</p>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="methods">Methods<ahref="#methods"class="hash-link"aria-label="Direct link to Methods"title="Direct link to Methods"></a></h2>
<table><thead><tr><th><p>Method</p></th><th><p>Modifiers</p></th><th><p>Description</p></th></tr></thead><tbody><tr><td><spanid="buffer"><ahref="/api/puppeteer.httpresponse.buffer">buffer()</a></span></td><td></td><td><p>Promise which resolves to a buffer with response body.</p><p><strong>Remarks:</strong></p><p>The buffer might be re-encoded by the browser based on HTTP-headers or other heuristics. If the browser failed to detect the correct encoding, the buffer might be encoded incorrectly. See <ahref="https://github.com/puppeteer/puppeteer/issues/6478"target="_blank"rel="noopener noreferrer">https://github.com/puppeteer/puppeteer/issues/6478</a>.</p></td></tr><tr><td><spanid="frame"><ahref="/api/puppeteer.httpresponse.frame">frame()</a></span></td><td></td><td><p>A <ahref="/api/puppeteer.frame">Frame</a> that initiated this response, or <code>null</code> if navigating to error pages.</p></td></tr><tr><td><spanid="fromcache"><ahref="/api/puppeteer.httpresponse.fromcache">fromCache()</a></span></td><td></td><td><p>True if the response was served from either the browser's disk cache or memory cache.</p></td></tr><tr><td><spanid="fromserviceworker"><ahref="/api/puppeteer.httpresponse.fromserviceworker">fromServiceWorker()</a></span></td><td></td><td><p>True if the response was served by a service worker.</p></td></tr><tr><td><spanid="headers"><ahref="/api/puppeteer.httpresponse.headers">headers()</a></span></td><td></td><td><p>An object with HTTP headers associated with the response. All header names are lower-case.</p></td></tr><tr><td><spanid="json"><ahref="/api/puppeteer.httpresponse.json">json()</a></span></td><td></td><td><p>Promise which resolves to a JSON representation of response body.</p><p><strong>Remarks:</strong></p><p>This method will throw if the response body is not parsable via <code>JSON.parse</code>.</p></td></tr><tr><td><spanid="ok"><ahref="/api/puppeteer.httpresponse.ok">ok()</a></span></td><td></td><td><p>True if the response was successful (status in the range 200-299).</p></td></tr><tr><td><spanid="remoteaddress"><ahref="/api/puppeteer.httpresponse.remoteaddress">remoteAddress()</a></span></td><td></td><td><p>The IP address and port number used to connect to the remote server.</p></td></tr><tr><td><spanid="request"><ahref="/api/puppeteer.httpresponse.request">request()</a></span></td><td></td><td><p>A matching <ahref="/api/puppeteer.httprequest">HTTPRequest</a> object.</p></td></tr><tr><td><spanid="securitydetails"><ahref="/api/puppeteer.httpresponse.securitydetails">securityDetails()</a></span></td><td></td><td><p><ahref="/api/puppeteer.securitydetails">SecurityDetails</a> if the response was received over the secure connection, or <code>null</code> otherwise.</p></td></tr><tr><td><spanid="status"><ahref="/api/puppeteer.httpresponse.status">status()</a></span></td><td></td><td><p>The status code of the response (e.g., 200 for a success).</p></td></tr><tr><td><spanid="statustext"><ahref="/api/puppeteer.httpresponse.statustext">statusText()</a></span></td><td></td><td><p>The status text of the response (e.g. usually an "OK" for a success).</p></td></tr><tr><td><spanid="text"><ahref="/api/puppeteer.httpresponse.text">text()</a></span></td><td></td><td><p>Promise which resolves to a text (utf8) representation of response body.</p></td></tr><tr><td><spanid="timing"><ahref="/api/puppeteer.httpresponse.timing">timing()</a></span></td><td></td><td><p>Timing information related to the response.</p></td></tr><tr><td><spanid="url"><ahref="/api/puppeteer.httpresponse.url">url()</a></span></td><td></td><td><p>The URL of the response.</p></td></tr></tbody></table></div></article><navclass="pagination-nav docusaurus-mt-lg"aria-label="Docs pages"><aclass="pagination-nav__link pagination-nav__link--prev"href="/api/puppeteer.httprequest.url"><divclass="pagination-nav__sublabel">Previous</div><divclass="pagination-nav__label">HTTPRequest.url</div></a><aclass="pagination-nav__link pagination-nav__link--next"href="/api/puppeteer.httpresponse.buffer"><divclas