RequestId class

Gives each request an id. It is sent back in the X-Request-Id header and can be read as req.requestId. LogMiddleware lines and the error reports of ExceptionHandler show it.

AppConfig(
  globalMiddleware: <dynamic>[
    const RequestId(),
    LogMiddleware(enabled: true),
  ],
);

When the client (or a proxy) sends an X-Request-Id that looks safe (1 to 128 characters of A-Z a-z 0-9 . _ -), Dox keeps it. Else Dox makes a new one: 32 hex characters. Set trustClient to false to always make a new one.

Implemented types

Constructors

RequestId({bool trustClient = true})
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
trustClient → bool
keep a safe X-Request-Id from the client
final

Methods

handle(IDoxRequest req) → IDoxRequest
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

make() → String
A new random id: 32 hex characters (128 bits).

Constants

the header name