The Koa request object is similar to the request object in Node and Express. It can be described as an abstraction of Node's request object. It provides added functionality with its properties and methods for building out everyday HTTP servers.
The methods and properties it exposes include the following:
- request.header: This returns an object containing the request headers. This is aliased in the context object, and can also be accessed with ctx.header. The following code block shows example usage of how the request.header property can be used to retrieve and log the headers from a request:
// log the request headers console.log(ctx.header); // or console.log(ctx.request.header);
- request.header=: This can be used to ...