A middleware placed in the chain to handle the request and response. There are three stages with three states of the response:
Of course, you can also skip parts of the chain by marking the response as completed or responded. The response can be marked as follows:
res.markAsResponded();
or
res.markAsCompleted();
The middleware must return void or a promise. Therefore, the middleware can also be asynchronous
The Gobits request object.
The Gobits response object.
The next function to call. This function should be called when the middleware is done.
Whether the middleware is in the first (false) or second pass (true).
An object that contains the options for a single request. Those options will override the global options. You can also add any custom property to this object, so that your middlewares can use it.
Generated using TypeDoc
Define the global options for the requests. Some options can be overridden by the request options.
The timeout for the request.
The type of the request (
json
orform
). This will be handled by the built-in middlewareUse the built-in middlewares provided by gobits (cannot be overriden)
The base url for the request. (cannot be overriden)