MCPcopy Create free account
hub / github.com/WICG/webpackage / Response

Class Response

js/bundle/src/decoder.ts:192–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190
191/** This class represents an HTTP resource in Web Bundle. */
192export class Response {
193 status: number;
194 headers: Headers;
195 body: Uint8Array;
196
197 constructor(responsesSectionItem: unknown[]) {
198 if (responsesSectionItem.length !== 2) {
199 throw new Error('Wrong response structure');
200 }
201 const { status, headers } = decodeResponseMap(
202 asBytestring(responsesSectionItem[0])
203 );
204 this.status = status;
205 this.headers = headers;
206 this.body = asBytestring(responsesSectionItem[1]);
207 }
208}
209
210function decodeResponseMap(cbor: Uint8Array): {
211 status: number;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected