<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/next/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="3"><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/next/api/puppeteer.httpresponse"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/api/puppeteer.httpresponse"hreflang="en"><linkdata-rh="true"rel="alternate"href="https://pptr.dev/next/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:<aclass="hash-link"aria-label="Direct link to Signature:"title="Direct link to Signature:"href="/next/api/puppeteer.httpresponse#signature"></a></h4>
<h2class="anchor anchorWithStickyNavbar_FNw8"id="remarks">Remarks<aclass="hash-link"aria-label="Direct link to Remarks"title="Direct link to Remarks"href="/next/api/puppeteer.httpresponse#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<aclass="hash-link"aria-label="Direct link to Methods"title="Direct link to Methods"href="/next/api/puppeteer.httpresponse#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="/next/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="/next/api/puppeteer.httpresponse.frame">frame()</a></span></td><td></td><td><p>A <ahref="/next/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="/next/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="/next/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="/next/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="/next/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="/next/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="/next/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="/next/api/puppeteer.httpresponse.request">request()</a></span></td><td></td><td><p>A matching <ahref="/next/api/puppeteer.httprequest">HTTPRequest</a> object.</p></td></tr><tr><td><spanid="securitydetails"><ahref="/next/api/puppeteer.httpresponse.securitydetails">securityDetails()</a></span></td><td></td><td><p><ahref="/next/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="/next/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="/next/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="/next/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="/next/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="/next/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="/next/api/puppeteer.httprequest.url"><divclass="pagination-nav__sublabel">Previous</div><divclass="pagination-nav__label">HTTPRequest.url</div></a><aclass="pagin