MCPcopy
hub / github.com/Uniswap/interface / from

Method from

src/serviceWorker/document.ts:99–110  ·  view source on GitHub ↗
(response: Response)

Source from the content-addressed store, hash-verified

97 */
98export class CachedDocument extends Response {
99 static async from(response: Response) {
100 const text = await response.text()
101
102 // Set the content-type explicitly. Some browsers (Android 12; Chrome 91) use an invalid content-type header.
103 const headers = new Headers(response.headers)
104 headers.set('Content-Type', 'text/html; charset=utf-8')
105 const init = { ...response, headers }
106
107 // Injects a marker into the document so that client code knows it was served from cache.
108 // The marker should be injected immediately in the <body> so it is available to client code.
109 return new CachedDocument(text.replace('<body>', '<body><script>window.__isDocumentCached=true</script>'), init)
110 }
111
112 private constructor(text: string, response: Response) {
113 super(text, response)

Callers 15

index.test.tsxFile · 0.80
BlurFunction · 0.80
ApprovalSummaryFunction · 0.80
AirdropModalFunction · 0.80
PortfolioSkeletonFunction · 0.80
parseApprovalFunction · 0.80
getLogoSrcsFunction · 0.80
useMultiChainPositionsFunction · 0.80
handleSelectChangeFunction · 0.80

Calls

no outgoing calls

Tested by 1

aliasFilteredTokensFunction · 0.64