route.abort([errorCode])
errorCode
<string> Optional error code. Defaults tofailed
, could be one of the following:'aborted'
- An operation was aborted (due to user action)'accessdenied'
- Permission to access a resource, other than the network, was denied'blockedbyclient'
- The client chose to block the request.'blockedbyresponse'
- The request failed because the response was delivered along with requirements which are not met (‘X-Frame-Options’ and ‘Content-Security-Policy’ ancestor checks, for instance).'connectionaborted'
- A connection timed out as a result of not receiving an ACK for data sent.'connectionclosed'
- A connection was closed (corresponding to a TCP FIN).- - A connection attempt failed.
'connectionrefused'
- A connection attempt was refused.'connectionreset'
- A connection was reset (corresponding to a TCP RST).'internetdisconnected'
- The Internet connection has been lost.'namenotresolved'
- The host name could not be resolved.'timedout'
- An operation timed out.'failed'
- A generic failure occurred.
Aborts the route’s request.
route.continue([overrides])
overrides
<Object> Optional request overrides, which can be one of the following:- returns: <Promise>
route.fulfill(response)
response
<Object> Response that will fulfill this route’s request.status
<> Response status code, defaults to200
.headers
<Object<, string>> Optional response headers. Header values will be converted to a string.contentType
<> If set, equals to settingContent-Type
response header.body
<string|> Optional response body.path
<string> Optional file path to respond with. The content type will be inferred from file extension. Ifpath
is a relative path, then it is resolved relative to .
Fulfills route’s request with given response.
An example of serving static file:
route.request()
- returns: <> A request to be routed.