You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2 - The Http response (or just the response code/body) is retrieved using one of the following:
job {
use! response = getResponse request // disposed at the end of async, don't
// fetch outside async body
// the above doesn't download the response, so you'll have to do that:
let! bodyStr = Response.readBodyAsString response
// OR:
//let! bodyBs = Response.readBodyAsBytes
// remember HttpFs doesn't buffer the stream (how would we know if we're
// downloading 3GiB?), so once you use one of the above methods, you can't do it
// again, but have to buffer/stash it yourself somewhere.
return bodyStr
}
IMO it should really say:
2 - The Http response (or just the response code/body) is retrieved using one of the following:
job {
use! response = getResponse request // disposed at the end of Hopac job, don't
// fetch outside Hopac job body
// while the above does download the full response, it doesn't give you access to the body content. You'll have to do this:
let! bodyStr = Response.readBodyAsString response
// OR:
//let! bodyBs = Response.readBodyAsBytes
// remember HttpFs doesn't buffer the stream (how would we know if we're
// downloading 3GiB?), so once you use one of the above methods, you can't do it
// again, but have to buffer/stash it yourself somewhere.
return bodyStr
}
as demonstrated by issue #158, wherein I got the full response even though I didn't think I was asking for it. And perhaps even say (the more examples of using Hopac with HttpFs in various situations the better), to be explicit:
If for some reason, you only want to get the headers, instead do:
let statusCode, contentType, headers =
Hopac.Hopac.job {
use! response = HttpFs.Client.getEventSourceResponse request
let statusCode = response.statusCode
let contentType = response.headers.[HttpFs.Client.ResponseHeader.ContentTypeResponse]
return statusCode, contentType, response.headers
} |> Hopac.Hopac.run
The text was updated successfully, but these errors were encountered:
The README currently states:
IMO it should really say:
2 - The Http response (or just the response code/body) is retrieved using one of the following:
job {
use! response = getResponse request // disposed at the end of Hopac job, don't
// fetch outside Hopac job body
// while the above does download the full response, it doesn't give you access to the body content. You'll have to do this:
let! bodyStr = Response.readBodyAsString response
// OR:
//let! bodyBs = Response.readBodyAsBytes
// remember HttpFs doesn't buffer the stream (how would we know if we're
// downloading 3GiB?), so once you use one of the above methods, you can't do it
// again, but have to buffer/stash it yourself somewhere.
return bodyStr
}
as demonstrated by issue #158, wherein I got the full response even though I didn't think I was asking for it. And perhaps even say (the more examples of using Hopac with HttpFs in various situations the better), to be explicit:
If for some reason, you only want to get the headers, instead do:
The text was updated successfully, but these errors were encountered: