query
- the parsed querystring, its format is specified by body
- the request payload, see Content-Type Parser for details on what request payloads Fastify natively parses and how to support other content typesparams
- the params matching the URL- - the headers getter and setter
raw
- the incoming HTTP request from Node corereq
(deprecated, use .raw
instead) - the incoming HTTP request from Node coreserver
- The Fastify server instance, scoped to the current encapsulation contextid
- the request IDlog
- the logger instance of the incoming requestip
- the IP address of the incoming requestips
- an array of the IP addresses, ordered from closest to furthest, in the X-Forwarded-For
header of the incoming request (only when the option is enabled)- - the protocol of the incoming request (
https
or http
) method
- the method of the incoming requesturl
- the URL of the incoming requestrouterMethod
- the method defined for the router that is handling the requestrouterPath
- the path pattern defined for the router that is handling the requestis404
- true if request is being handled by 404 handler, false if it is notconnection
- Deprecated, use socket
instead. The underlying connection of the incoming request.socket
- the underlying connection of the incoming requestcontext
- A Fastify internal object. You should not use it directly or modify it. It is useful to access one special key:
context.config
- The route config object.
console.log(request.body)
console.log(request.params)
console.log(request.headers)
console.log(request.raw)
console.log(request.server)
console.log(request.id)
console.log(request.ip)
console.log(request.ips)
console.log(request.hostname)
console.log(request.protocol)
console.log(request.url)
console.log(request.routerMethod)
console.log(request.routerPath)