3.1.0 • Published 4 months ago

@mercuryworkshop/bare-client-custom v3.1.0

Weekly downloads
-
License
LGPL-3.0
Repository
github
Last release
4 months ago

Bare-Client-Custom

a mock bare client allowing you to slip in custom values for testing.

replace in package.json: "@tomphttp/bare-client": "version" with "@tomphttp/bare-client": "file:../bare-client-custom/" and rebuild to take advantage of bare-client-custom

on the client side, create a class that extends Client

class TestClient extends Client {
   
   request(method: string, requestHeaders: BareHeaders, body: BodyInit | null, remote: URL, cache: string | undefined, duplex: string | undefined, signal: AbortSignal | undefined): Promise<BareResponse> {
     return new Response("test");
   }
   connect(remote: URL, protocols: string[], getRequestHeaders: GetRequestHeadersCallback, onMeta: MetaCallback, onReadyState: ReadyStateCallback, webSocketImpl: WebSocketImpl): WebSocket {
     
   }
}
let testclient = new TestClient;


setBareClientImplementation(testclient);

and bare-client-custom will take care of the rest

3.1.0

4 months ago

2.2.1-alpha

4 months ago

2.2.0-alpha

9 months ago