Liking cljdoc? Tell your friends :D
Clojure only.

sturdy.middleware.request-id


wrap-request-idclj

(wrap-request-id handler)
(wrap-request-id handler
                 {:keys [header-names response-name id-fn]
                  :or {header-names ["x-request-id" "x-correlation-id"
                                     "traceparent"]
                       response-name "X-Request-Id"
                       id-fn (fn* [] (str (random-uuid)))}})

Attach a request id to req/resp.

Options: :header-names vector of header names to trust (default common ones) :response-name header name to set on the response (default "X-Request-Id") :id-fn 0-arg fn to generate an id (default random UUID)

Notes:

  • If a trusted incoming header is present and passes validation, it is used.
  • If "traceparent" is trusted, the W3C trace-id (32 hex chars) is used.
Attach a request id to req/resp.

Options:
:header-names   vector of header names to trust (default common ones)
:response-name  header name to set on the response (default "X-Request-Id")
:id-fn          0-arg fn to generate an id (default random UUID)

Notes:
- If a trusted incoming header is present and passes validation, it is used.
- If "traceparent" is trusted, the W3C trace-id (32 hex chars) is used.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close