@mercuryworkshop/bare-client-custom
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @mercuryworkshop/bare-client-custom

Weekly Downloads

7

Version

3.1.0

License

LGPL-3.0

Unpacked Size

117 kB

Total Files

17

Last publish

Collaborators

  • avad3
  • ading2210
  • programmerin-wonderland
  • r58playz
  • percslol
  • coolelectronics