I am using F# with HttpFs.Client and Hopac.
I am able to get Response body and value of each node of JSON/XML response by using code like:
[<Test>]
let ``Test a Create user API``() =
let response = Request.createUrl Post "https://reqres.in/api/users"
|> Request.setHeader (Accept "application/json")
|> Request.bodyString ReadFile
|> Request.responseAsString
|> run
printfn "Response of get is %s: " response
let info = JsonValue.Parse(response)
let ID = info?id
printfn "ID in Response is %i: " (ID.AsInteger())
But how do I get a response code, response headers, and response cookies? I need to get this inside the same method as shown above so that I can do the assertion on these items too.
I did try response.StatusCode, response.Cookies.["cookie1"] but there are no such methods comes up when I add period after response.
Please read the doc https://github.com/haf/Http.fs
Point 3 shows how to access cookies and headers in the response.