We have a simple F# console app that sends a HTTP POST request to a WebAPI endpoint via FSharp.Data Http.Request
. We are using the customizeHttpRequest
parameter in order to try to set the request timeout property. Our usage is as follows:
let response = Http.Request(
serviceEndpoint,
headers = requestHeaders,
body = requestBody,
silentHttpErrors = true,
customizeHttpRequest = (fun request -> request.Timeout <- 1000; request))
We are observing that our custom timeout is ignored (i.e. the request does not timeout after 1 second as in this example). We have also observed that the request will not timeout after the default System.Net.HttpWebRequest
timeout of 100,000ms.
Is there an issue here, or are we not using the customizeHttpRequest
parameter correctly?
FSharp.Data uses the asynchronous GetResponse
method. According to MSDN, in that case the timeout set on the HttpWebRequest
object isn't considered and handling the timeout is left for the client code to implement.
Unfortunately FSharp.Data doesn't do it. There's an open issue for implementing it here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With