Creates and starts a TestHttpServer instance.
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.
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 TestHttpServers.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
Abstract class that provides the same static factory methods as TestHttpServer.
This is provided only because some JavaScript projects may have difficulty importing a class that has both a constructor and static methods (transpilers may copy the import in a way that preserves only the constructor function and not the static members).
TestHttpServers.start()
is exactly equivalent toTestHttpServer.start()
.