Header menu logo FsHttp

Access HttpClient and HttpMessage

Transform underlying http client and do whatever you feel you gave to do:

http {
    GET @"https://reqres.in/api/users?page=2&delay=3"
    config_transformHttpClient (fun httpClient ->
        // this will cause a timeout exception
        httpClient.Timeout <- System.TimeSpan.FromMilliseconds 1.0
        httpClient)
}

Transform underlying http request message:

http {
    GET @"https://reqres.in/api/users?page=2&delay=3"
    config_transformHttpRequestMessage (fun msg ->
        printfn "HTTP message: %A" msg
        msg)
}
namespace FsHttp
Multiple items
static member HttpBuilder.http: HeaderContext

--------------------
property HttpBuilder.http: HeaderContext with get
custom operation: GET (string) Calls IRequestContext.Get
custom operation: config_transformHttpClient (System.Net.Http.HttpClient -> System.Net.Http.HttpClient) Calls IRequestContext.TransformHttpClient
val httpClient: System.Net.Http.HttpClient
property System.Net.Http.HttpClient.Timeout: System.TimeSpan with get, set
<summary>Gets or sets the timespan to wait before the request times out.</summary>
<exception cref="T:System.ArgumentOutOfRangeException">The timeout specified is less than or equal to zero and is not <see cref="F:System.Threading.Timeout.InfiniteTimeSpan" />.</exception>
<exception cref="T:System.InvalidOperationException">An operation has already been started on the current instance.</exception>
<exception cref="T:System.ObjectDisposedException">The current instance has been disposed.</exception>
<returns>The timespan to wait before the request times out.</returns>
namespace System
Multiple items
[<Struct>] type TimeSpan = new: hours: int * minutes: int * seconds: int -> unit + 4 overloads member Add: ts: TimeSpan -> TimeSpan member CompareTo: value: obj -> int + 1 overload member Divide: divisor: float -> TimeSpan + 1 overload member Duration: unit -> TimeSpan member Equals: value: obj -> bool + 2 overloads member GetHashCode: unit -> int member Multiply: factor: float -> TimeSpan member Negate: unit -> TimeSpan member Subtract: ts: TimeSpan -> TimeSpan ...
<summary>Represents a time interval.</summary>

--------------------
System.TimeSpan ()
System.TimeSpan(ticks: int64) : System.TimeSpan
System.TimeSpan(hours: int, minutes: int, seconds: int) : System.TimeSpan
System.TimeSpan(days: int, hours: int, minutes: int, seconds: int) : System.TimeSpan
System.TimeSpan(days: int, hours: int, minutes: int, seconds: int, milliseconds: int) : System.TimeSpan
System.TimeSpan(days: int, hours: int, minutes: int, seconds: int, milliseconds: int, microseconds: int) : System.TimeSpan
System.TimeSpan.FromMilliseconds(value: float) : System.TimeSpan
custom operation: config_transformHttpRequestMessage (System.Net.Http.HttpRequestMessage -> System.Net.Http.HttpRequestMessage) Calls IRequestContext.TransformHttpRequestMessage
val msg: System.Net.Http.HttpRequestMessage
val printfn: format: Printf.TextWriterFormat<'T> -> 'T

Type something to start searching.