Optional
corsOptional
debugShould the server print extra debug information?
Optional
http2Should HTTP/2 be enabled? Can be true, false, or 'fallback'. If true, HTTP/2 is used for all clients supporting it. If false, HTTP/2 is never used. If 'fallback' HTTP/2 is used only for clients that do not advertise support for HTTP/1.1, but HTTP/1.1 is used by preference in all other cases.
Client HTTP/2 support is only advertised as part of the TLS options. When no HTTPS configuration is provided, 'fallback' is equivalent to false.
Optional
httpsThe HTTPS settings to be used. Optional, only HTTP interception will be enabled if omitted. This should be set to either a { key, cert } object containing the private key and certificate in PEM format, or a { keyPath, certPath } object containing the path to files containing that content.
Optional
maxThe maximum body size to process, in bytes.
Bodies larger than this will be dropped, becoming empty, so they won't match body matchers, won't be available in .seenRequests, and won't be included in subscribed event data. Body data will still typically be included in passed through request & response data, in most cases, so this won't affect the external HTTP clients otherwise.
Optional
recordRecord the requests & response for all traffic matched by each rule, and make it available via endpoint.getSeenRequests().
Defaults to true. It can be useful to set this to false if lots of data will be sent to/via the server, to avoid storing all traffic in memory unnecessarily, if getSeenRequests will not be used.
If this is set to false then getSeenRequests() will always return an empty array. This only disables the built-in persistence of request data, so traffic can still be captured live or stored elsewhere using .on('request') & .on('response').
Optional
suggestBy default, requests that match no rules will receive an explanation of the request & existing rules, followed by some suggested example Mockttp code which could be used to match the rule.
In some cases where the end client is unaware of Mockttp, these example
suggestions are just confusing. Set suggestChanges
to false to disable it.
Should the server automatically respond to OPTIONS requests with a permissive response?
Defaults to true for remote clients (e.g. in the browser), and false otherwise. If this is set to false, browser requests will typically fail unless you stub OPTIONS responses by hand.