goosetherumfoodle
goosetherumfoodle

Reputation: 25

Servant: see all request headers

I know from the documentation that I can do something like the following to capture a specific header:

type MyApi = "view-my-referer" :> Header "from" Referer :> Get '[JSON] Referer

But I'm exploring some webhooks that aren't well documented, and I'd like to just inspect all the headers in the request.

Upvotes: 1

Views: 433

Answers (1)

bergey
bergey

Reputation: 3071

I use Network.Wai.Middleware.RequestLogger to log headers for all incoming requests, regardless of which Servant endpoint ends up handling the request. I've used this to understand under-documented APIs, and for other sorts of debugging.

Upvotes: 4

Related Questions