request property

Request get request

Use this to access the current request in the zone.

This can be useful when you need to access the request in a service or controller that is not directly called by the router.

The request is stored in the zone when the request is processed by the router. Therefore, you can access the request in all services and controllers that are called by the router.

If you need to access the request in a service or controller that is called outside of the request scope, you need to provide the request instance to the service or controller.

Throws MissingServerContextException if no request context is available.

Implementation

static Request get request {
  return ServerContext.current.request;
}