The server's self-signed certificate, if it is a secure server.
The server's hostname (always "localhost" in this implementation).
The server's port.
An AsyncQueue of all requests handled so far. Call await server.requests.take()
to block
untiil the server has handled a request.
The server's base URL ("http://localhost:8000").
Specifies a TestHttpHandler to use for all requests that are not otherwise matched.
The request handler. This is normally created with a function like respond.
The same server.
Stops the server.
Stops the server and provides a Promise to indicate when it is completely stopped.
Specifies a TestHttpHandler to use for requests with the specified method and path. This overrides any previous handler for the same method and path.
The HTTP method.
The request path.
The same server.
Consumes the next received request, waiting until one is available.
A Promise that will be resolved with a TestHttpRequest.
Returns the total number of requests that have been received.
The number of requests so far.
Creates and starts a TestHttpServer instance.
Note: in a non-TypeScript project that uses a transpiler, you may not be able to access this static method; if so, use the same method in TestHttpServers instead.
Any desired [[http.ServerOptions]].
A specific port to listen on; if omitted, it picks an available port.
Creates and starts a TestHttpServer instance that acts as an HTTP proxy.
The server will only act as a proxy and will ignore any request handlers that you specify, but
it still has the same properties as a regular TestHttpServer, behaves the same in terms of
dynamically choosing a port, and allows you to inspect received requests. The received
requests will have a path
property equal to either the full request URL or, if using a
tunneling agent, the request URL minus the path.
Note that the current implementation does not support proxying a request to an HTTPS URL.
Any desired [[http.ServerOptions]].
A specific port to listen on; if omitted, it picks an available port.
Creates and starts a TestHttpServer instance that uses HTTPS, with a self-signed certificate.
Note: in a non-TypeScript project that uses a transpiler, you may not be able to access this static method; if so, use the same method in TestHttpServers instead.
Any desired [[https.ServerOptions]] other than the certificate.
A specific port to listen on; if omitted, it picks an available port.
Creates and starts a TestHttpServer instance that acts as a secure HTTP proxy with a self-signed certificate.
This is the same as TestHttpServer.startProxy, but the proxy server itself is secure. Note that the current implementation does not support proxying a request to an HTTPS URL (that is, when the target server is itself secure).
Any desired [[https.ServerOptions]] other than the certificate.
A specific port to listen on; if omitted, it picks an available port.
Generated using TypeDoc
A wrapper for Node's HTTP server API that provides convenient semantics for test code.
Do not use this for actual server applications, since its request matching logic is inefficient and its request queue can grow without limit.