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

Method addExchange

js/bundle/src/encoder.ts:57–72  ·  view source on GitHub ↗
(
    url: string,
    status: number,
    headers: Headers,
    payload: Uint8Array | string
  )

Source from the content-addressed store, hash-verified

55 }
56
57 addExchange(
58 url: string,
59 status: number,
60 headers: Headers,
61 payload: Uint8Array | string
62 ): BundleBuilder {
63 validateExchangeURL(url);
64 if (typeof payload === 'string') {
65 payload = byteString(payload);
66 }
67 this.addIndexEntry(
68 url,
69 this.addResponse(new HeaderMap(status, headers), payload)
70 );
71 return this;
72 }
73
74 setPrimaryURL(url: string): BundleBuilder {
75 return this.compatAdapter.setPrimaryURL(url);

Callers 7

addFileFunction · 0.45
addFilesRecursivelyFunction · 0.45
encoder_test.jsFile · 0.45
decoder_test.jsFile · 0.45
cli_test.jsFile · 0.45

Calls 4

addIndexEntryMethod · 0.95
addResponseMethod · 0.95
validateExchangeURLFunction · 0.85
byteStringFunction · 0.85

Tested by

no test coverage detected