How do I set a HTTP header for a request with wreq?

142 Views Asked by At

I see there is a likely function to do this of getWith which passes an Option value.

However looking up Option type seems to show something with very little info in haddock: enter image description here

How can I set these?

1

There are 1 best solutions below

0
On BEST ANSWER

wreq uses lenses hence it can be done using the below:

let opts = defaults
           & header "Content-Type" .~ ["application/json"]
getWith opts "http://localhost"