Flurl.Http Default implementation of IHttpClientFactory used by FlurlHttp. The created HttpClient includes hooks that enable FlurlHttp's testing features and respect its configuration settings. Therefore, custom factories should inherit from this class, rather than implementing IHttpClientFactory directly. Override in custom factory to customize the creation of HttpClient used in all Flurl HTTP calls. In order not to lose Flurl.Http functionality, it is recommended to call base.CreateClient and customize the result. Override in custom factory to customize the creation of HttpClientHandler used in all Flurl HTTP calls. In order not to lose Flurl.Http functionality, it is recommended to call base.CreateMessageHandler and customize the result. ISerializer implementation that converts an object representing name/value pairs to a URL-encoded string. Default serializer used in calls to PostUrlEncodedAsync, etc. Serializes the specified object. The object. Deserializes the specified s. The s. Deserializing to UrlEncoded not supported. Deserializes the specified stream. The stream. Deserializing to UrlEncoded not supported. Encapsulates a creation/caching strategy for IFlurlClient instances. Custom factories looking to extend Flurl's behavior should inherit from this class, rather than implementing IFlurlClientFactory directly. By default, uses a caching strategy of one FlurlClient per host. This maximizes reuse of underlying HttpClient/Handler while allowing things like cookies to be host-specific. The URL. The FlurlClient instance. Defines a strategy for getting a cache key based on a Url. Default implementation returns the host part (i.e www.api.com) so that all calls to the same host use the same FlurlClient (and HttpClient/HttpMessageHandler) instance. The URL. The cache key Creates a new FlurlClient The URL (not used) Disposes all cached IFlurlClient instances and clears the cache. A set of properties that affect Flurl.Http behavior Creates a new FlurlHttpSettings object. Gets or sets the default values to fall back on when values are not explicitly set on this instance. Gets or sets the HTTP request timeout. Gets or sets a pattern representing a range of HTTP status codes which (in addtion to 2xx) will NOT result in Flurl.Http throwing an Exception. Examples: "3xx", "100,300,600", "100-299,6xx", "*" (allow everything) 2xx will never throw regardless of this setting. Gets or sets a value indicating whether cookies should be sent/received with each HTTP request. Gets or sets object used to serialize and deserialize JSON. Default implementation uses Newtonsoft Json.NET. Gets or sets object used to serialize URL-encoded data. (Deserialization not supported in default implementation.) Gets or sets a callback that is called immediately before every HTTP request is sent. Gets or sets a callback that is asynchronously called immediately before every HTTP request is sent. Gets or sets a callback that is called immediately after every HTTP response is received. Gets or sets a callback that is asynchronously called immediately after every HTTP response is received. Gets or sets a callback that is called when an error occurs during any HTTP call, including when any non-success HTTP status code is returned in the response. Response should be null-checked if used in the event handler. Gets or sets a callback that is asynchronously called when an error occurs during any HTTP call, including when any non-success HTTP status code is returned in the response. Response should be null-checked if used in the event handler. Resets all overridden settings to their default values. For example, on a FlurlRequest, all settings are reset to FlurlClient-level settings. Gets a settings value from this instance if explicitly set, otherwise from the default settings that back this instance. Sets a settings value for this instance. Client-level settings for Flurl.Http Specifies the time to keep the underlying HTTP/TCP conneciton open. When expired, a Connection: close header is sent with the next request, which should force a new connection and DSN lookup to occur on the next call. Default is null, effectively disabling the behavior. Gets or sets a factory used to create the HttpClient and HttpMessageHandler used for HTTP calls. Whenever possible, custom factory implementations should inherit from DefaultHttpClientFactory, only override the method(s) needed, call the base method, and modify the result. Global default settings for Flurl.Http Defaults at the global level do not make sense and will always be null. Gets or sets the factory that defines creating, caching, and reusing FlurlClient instances and, by proxy, HttpClient instances. Resets all global settings to their Flurl.Http-defined default values. Settings overrides within the context of an HttpTest Resets all test settings to their Flurl.Http-defined default values. Interface for defining a strategy for creating, caching, and reusing IFlurlClient instances and, by proxy, their underlying HttpClient instances. Strategy to create a FlurlClient or reuse an exisitng one, based on URL being called. The URL being called. Extension methods on IFlurlClientFactory Provides thread-safe access to a specific IFlurlClient, typically to configure settings and default headers. The URL is used to find the client, but keep in mind that the same client will be used in all calls to the same host by default. This IFlurlClientFactory. the URL used to find the IFlurlClient. the action to perform against the IFlurlClient. Interface defining creation of HttpClient and HttpMessageHandler used in all Flurl HTTP calls. Implementation can be added via FlurlHttp.Configure. However, in order not to lose much of Flurl.Http's functionality, it's almost always best to inherit DefaultHttpClientFactory and extend the base implementations, rather than implementing this interface directly. Defines how HttpClient should be instantiated and configured by default. Do NOT attempt to cache/reuse HttpClient instances here - that should be done at the FlurlClient level via a custom FlurlClientFactory that gets registered globally. The HttpMessageHandler used to construct the HttpClient. Defines how the Contract for serializing and deserializing objects. Serializes an object to a string representation. Deserializes an object from a string representation. Deserializes an object from a stream representation. ISerializer implementation that uses Newtonsoft Json.NET. Default serializer used in calls to GetJsonAsync, PostJsonAsync, etc. Initializes a new instance of the class. The settings. Serializes the specified object. The object. Deserializes the specified s. The s. Deserializes the specified stream. The stream. An IFlurlClientFactory implementation that caches and reuses the same IFlurlClient instance per URL requested, which it assumes is a "base" URL, and sets the IFlurlClient.BaseUrl property to that value. Ideal for use with IoC containers - register as a singleton, inject into a service that wraps some web service, and use to set a private IFlurlClient field in the constructor. Returns the entire URL, which is assumed to be some "base" URL for a service. The URL. The cache key Returns a new new FlurlClient with BaseUrl set to the URL passed. The URL An IFlurlClientFactory implementation that caches and reuses the same one instance of FlurlClient per host being called. Maximizes reuse of underlying HttpClient/Handler while allowing things like cookies to be host-specific. This is the default implementation used when calls are made fluently off Urls/strings. Returns the host part of the URL (i.e. www.api.com) so that all calls to the same host use the same FlurlClient (and HttpClient/HttpMessageHandler) instance. The URL. The cache key Provides HTTP content based on a serialized JSON object, with the JSON string captured to a property so it can be read without affecting the read-once content stream. Initializes a new instance of the class. The json. Provides HTTP content for a multipart/form-data request. Gets an array of HttpContent objects that make up the parts of the multipart request. Initializes a new instance of the class. The FlurlHttpSettings used to serialize each content part. (Defaults to FlurlHttp.GlobalSettings.) Add a content part to the multipart request. The control name of the part. The HttpContent of the part. This CapturedMultipartContent instance (supports method chaining). Add a simple string part to the multipart request. The control name of the part. The string content of the part. The encoding of the part. The media type of the part. This CapturedMultipartContent instance (supports method chaining). Add multiple string parts to the multipart request by parsing an object's properties into control name/content pairs. The object (typically anonymous) whose properties are parsed into control name/content pairs. The encoding of the parts. The media type of the parts. This CapturedMultipartContent instance (supports method chaining). Add a JSON-serialized part to the multipart request. The control name of the part. The content of the part, which will be serialized to JSON. This CapturedMultipartContent instance (supports method chaining). Add a URL-encoded part to the multipart request. The control name of the part. The content of the part, whose properties will be parsed and serialized to URL-encoded format. This CapturedMultipartContent instance (supports method chaining). Adds a file to the multipart request from a stream. The control name of the part. The file stream to send. The filename, added to the Content-Disposition header of the part. The media type of the file. The buffer size of the stream upload in bytes. Defaults to 4096. This CapturedMultipartContent instance (supports method chaining). Adds a file to the multipart request from a local path. The control name of the part. The local path to the file. The media type of the file. The buffer size of the stream upload in bytes. Defaults to 4096. The filename, added to the Content-Disposition header of the part. Defaults to local file name. This CapturedMultipartContent instance (supports method chaining). Provides HTTP content based on a string, with the string itself captured to a property so it can be read without affecting the read-once content stream. The content body captured as a string. Can be read multiple times (unlike the content stream). Initializes a new instance of the class. The content. The encoding. Type of the media. Provides HTTP content based on an object serialized to URL-encoded name-value pairs. Useful in simulating an HTML form POST. Serialized content is captured to Content property so it can be read without affecting the read-once content stream. Initializes a new instance of the class. Content represented as a (typically anonymous) object, which will be parsed into name/value pairs. Represents HTTP content based on a local file. Typically used with PostMultipartAsync for uploading files. The local file path. Initializes a new instance of the class. The local file path. The buffer size of the stream upload in bytes. Defaults to 4096. Serializes to stream asynchronous. The stream. The context. Tries the length of the compute. The length. Fluent extension methods for working with HTTP cookies. Allows cookies to be sent and received. Not necessary to call when setting cookies via WithCookie/WithCookies. The IFlurlClient or IFlurlRequest. This IFlurlClient. Sets an HTTP cookie to be sent with this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. The cookie to set. This IFlurlClient. Sets an HTTP cookie to be sent with this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. The cookie name. The cookie value. The cookie expiration (optional). If excluded, cookie only lives for duration of session. This IFlurlClient. Sets HTTP cookies to be sent with this IFlurlRequest or all requests made with this IFlurlClient, based on property names/values of the provided object, or keys/values if object is a dictionary. The IFlurlClient or IFlurlRequest. Names/values of HTTP cookies to set. Typically an anonymous object or IDictionary. Expiration for all cookies (optional). If excluded, cookies only live for duration of session. This IFlurlClient. Fluent extension methods for downloading a file. Asynchronously downloads a file at the specified URL. The flurl request. Path of local folder where file is to be downloaded. Name of local file. If not specified, the source filename (from Content-Dispostion header, or last segment of the URL) is used. Buffer size in bytes. Default is 4096. The token to monitor for cancellation requests. A Task whose result is the local path of the downloaded file. Asynchronously downloads a file at the specified URL. The Url. Path of local folder where file is to be downloaded. Name of local file. If not specified, the source filename (last segment of the URL) is used. Buffer size in bytes. Default is 4096. The token to monitor for cancellation requests. A Task whose result is the local path of the downloaded file. Asynchronously downloads a file at the specified URL. The Url. Path of local folder where file is to be downloaded. Name of local file. If not specified, the source filename (last segment of the URL) is used. Buffer size in bytes. Default is 4096. The token to monitor for cancellation requests. A Task whose result is the local path of the downloaded file. Replaces invalid path characters with underscores. Interface defining FlurlClient's contract (useful for mocking and DI) Gets or sets the FlurlHttpSettings object used by this client. Gets the HttpClient to be used in subsequent HTTP calls. Creation (when necessary) is delegated to FlurlHttp.FlurlClientFactory. Reused for the life of the FlurlClient. Gets the HttpMessageHandler to be used in subsequent HTTP calls. Creation (when necessary) is delegated to FlurlHttp.FlurlClientFactory. Gets or sets base URL associated with this client. Creates a new IFlurlRequest that can be further built and sent fluently. The URL or URL segments for the request. If BaseUrl is defined, it is assumed that these are path segments off that base. A new IFlurlRequest Gets a value indicating whether this instance (and its underlying HttpClient) has been disposed. A reusable object for making HTTP calls. Initializes a new instance of the class. The base URL associated with this client. Initializes a new instance of the class, wrapping an existing HttpClient. Generally you should let Flurl create and manage HttpClient instances for you, but you might, for example, have an HttpClient instance that was created by a 3rd-party library and you want to use Flurl to build and send calls with it. The instantiated HttpClient instance. Disposes the underlying HttpClient and HttpMessageHandler. A static container for global configuration settings affecting Flurl.Http behavior. Globally configured Flurl.Http settings. Should normally be written to by calling FlurlHttp.Configure once application at startup. Provides thread-safe access to Flurl.Http's global configuration settings. Should only be called once at application startup. the action to perform against the GlobalSettings. Provides thread-safe access to a specific IFlurlClient, typically to configure settings and default headers. The URL is used to find the client, but keep in mind that the same client will be used in all calls to the same host by default. the URL used to find the IFlurlClient. the action to perform against the IFlurlClient. An exception that is thrown when an HTTP call made by Flurl.Http fails, including when the response indicates an unsuccessful HTTP status code. An object containing details about the failed HTTP call Initializes a new instance of the class. The call. The message. The inner. Initializes a new instance of the class. The call. The message. The captured response body, if available. The inner. Initializes a new instance of the class. The call. The inner. Initializes a new instance of the class. The call. Gets the response body of the failed call. A task whose result is the string contents of the response body. Deserializes the JSON response body to an object of the given type. A type whose structure matches the expected JSON response. A task whose result is an object containing data in the response body. Deserializes the JSON response body to a dynamic object. A task whose result is an object containing data in the response body. An exception that is thrown when an HTTP call made by Flurl.Http times out. Initializes a new instance of the class. The HttpCall instance. The inner exception. An exception that is thrown when an HTTP response could not be parsed to a particular format. Initializes a new instance of the class. The HttpCall instance. The format that could not be parsed to, i.e. JSON. The response body. The inner exception. The format that could not be parsed to, i.e. JSON. Interface defining FlurlRequest's contract (useful for mocking and DI) Gets or sets the IFlurlClient to use when sending the request. Gets or sets the URL to be called. Creates and asynchronously sends an HttpRequestMethod. Mainly used to implement higher-level extension methods (GetJsonAsync, etc). The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. A chainable wrapper around HttpClient and Flurl.Url. Initializes a new instance of the class. The URL to call with this FlurlRequest instance. Gets or sets the FlurlHttpSettings used by this request. Collection of headers sent on this request. Collection of HttpCookies sent and received by the IFlurlClient associated with this request. Auto-generated fluent extension methods on String, Url, and IFlurlRequest. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous request. The IFlurlRequest instance. The HTTP method used to make the request. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous request. The IFlurlRequest instance. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous request. The IFlurlRequest instance. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous request. The URL. The HTTP method used to make the request. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous GET request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous GET request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to an object of type T. Sends an asynchronous GET request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to a dynamic. Sends an asynchronous GET request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to a list of dynamics. Sends an asynchronous GET request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a string. Sends an asynchronous GET request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a Stream. Sends an asynchronous GET request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a byte array. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to an object of type T. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to a dynamic. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to a list of dynamics. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a string. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a Stream. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a byte array. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to an object of type T. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to a dynamic. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the JSON response body deserialized to a list of dynamics. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a string. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a Stream. Creates a FlurlRequest from the URL and sends an asynchronous GET request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the response body as a byte array. Sends an asynchronous POST request. The IFlurlRequest instance. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous POST request. The IFlurlRequest instance. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous POST request. The IFlurlRequest instance. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous POST request. The IFlurlRequest instance. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous POST request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous HEAD request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous HEAD request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous HEAD request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous PUT request. The IFlurlRequest instance. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PUT request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PUT request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous PUT request. The IFlurlRequest instance. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PUT request. The URL. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PUT request. The URL. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous PUT request. The IFlurlRequest instance. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PUT request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PUT request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous DELETE request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous DELETE request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous DELETE request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous PATCH request. The IFlurlRequest instance. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PATCH request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PATCH request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous PATCH request. The IFlurlRequest instance. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PATCH request. The URL. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PATCH request. The URL. An object representing the request body, which will be serialized to JSON. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous PATCH request. The IFlurlRequest instance. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PATCH request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous PATCH request. The URL. Contents of the request body. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Sends an asynchronous OPTIONS request. The IFlurlRequest instance. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous OPTIONS request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous OPTIONS request. The URL. The token to monitor for cancellation requests. The HttpCompletionOption used in the request. Optional. A Task whose result is the received HttpResponseMessage. Creates a new FlurlRequest with the URL and sets a request header. The URL. The header name. The header value. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets request headers based on property names/values of the provided object, or keys/values if object is a dictionary, to be sent The URL. Names/values of HTTP headers to set. Typically an anonymous object or IDictionary. If true, underscores in property names will be replaced by hyphens. Default is true. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the Authorization header according to Basic Authentication protocol. The URL. Username of authenticating user. Password of authenticating user. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the Authorization header with a bearer token according to OAuth 2.0 specification. The URL. The acquired oAuth bearer token. The IFlurlRequest. Creates a new FlurlRequest with the URL and allows cookies to be sent and received. Not necessary to call when setting cookies via WithCookie/WithCookies. The URL. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets an HTTP cookie to be sent The URL. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets an HTTP cookie to be sent. The URL. The cookie name. The cookie value. The cookie expiration (optional). If excluded, cookie only lives for duration of session. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets HTTP cookies to be sent, based on property names / values of the provided object, or keys / values if object is a dictionary. The URL. Names/values of HTTP cookies to set. Typically an anonymous object or IDictionary. Expiration for all cookies (optional). If excluded, cookies only live for duration of session. The IFlurlRequest. Creates a new FlurlRequest with the URL and allows changing its Settings inline. The URL. A delegate defining the Settings changes. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the request timeout. The URL. Time to wait before the request times out. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the request timeout. The URL. Seconds to wait before the request times out. The IFlurlRequest. Creates a new FlurlRequest with the URL and adds a pattern representing an HTTP status code or range of codes which (in addition to 2xx) will NOT result in a FlurlHttpException being thrown. The URL. Examples: "3xx", "100,300,600", "100-299,6xx" The IFlurlRequest. Creates a new FlurlRequest with the URL and adds an HttpStatusCode which (in addtion to 2xx) will NOT result in a FlurlHttpException being thrown. The URL. The HttpStatusCode(s) to allow. The IFlurlRequest. Creates a new FlurlRequest with the URL and configures it to allow any returned HTTP status without throwing a FlurlHttpException. The URL. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets a request header. The URL. The header name. The header value. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets request headers based on property names/values of the provided object, or keys/values if object is a dictionary, to be sent The URL. Names/values of HTTP headers to set. Typically an anonymous object or IDictionary. If true, underscores in property names will be replaced by hyphens. Default is true. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the Authorization header according to Basic Authentication protocol. The URL. Username of authenticating user. Password of authenticating user. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the Authorization header with a bearer token according to OAuth 2.0 specification. The URL. The acquired oAuth bearer token. The IFlurlRequest. Creates a new FlurlRequest with the URL and allows cookies to be sent and received. Not necessary to call when setting cookies via WithCookie/WithCookies. The URL. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets an HTTP cookie to be sent The URL. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets an HTTP cookie to be sent. The URL. The cookie name. The cookie value. The cookie expiration (optional). If excluded, cookie only lives for duration of session. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets HTTP cookies to be sent, based on property names / values of the provided object, or keys / values if object is a dictionary. The URL. Names/values of HTTP cookies to set. Typically an anonymous object or IDictionary. Expiration for all cookies (optional). If excluded, cookies only live for duration of session. The IFlurlRequest. Creates a new FlurlRequest with the URL and allows changing its Settings inline. The URL. A delegate defining the Settings changes. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the request timeout. The URL. Time to wait before the request times out. The IFlurlRequest. Creates a new FlurlRequest with the URL and sets the request timeout. The URL. Seconds to wait before the request times out. The IFlurlRequest. Creates a new FlurlRequest with the URL and adds a pattern representing an HTTP status code or range of codes which (in addition to 2xx) will NOT result in a FlurlHttpException being thrown. The URL. Examples: "3xx", "100,300,600", "100-299,6xx" The IFlurlRequest. Creates a new FlurlRequest with the URL and adds an HttpStatusCode which (in addtion to 2xx) will NOT result in a FlurlHttpException being thrown. The URL. The HttpStatusCode(s) to allow. The IFlurlRequest. Creates a new FlurlRequest with the URL and configures it to allow any returned HTTP status without throwing a FlurlHttpException. The URL. The IFlurlRequest. Fluent extension methods for working with HTTP request headers. Sets an HTTP header to be sent with this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. HTTP header name. HTTP header value. This IFlurlClient or IFlurlRequest. Sets HTTP headers based on property names/values of the provided object, or keys/values if object is a dictionary, to be sent with this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. Names/values of HTTP headers to set. Typically an anonymous object or IDictionary. If true, underscores in property names will be replaced by hyphens. Default is true. This IFlurlClient or IFlurlRequest. Sets HTTP authorization header according to Basic Authentication protocol to be sent with this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. Username of authenticating user. Password of authenticating user. This IFlurlClient or IFlurlRequest. Sets HTTP authorization header with acquired bearer token according to OAuth 2.0 specification to be sent with this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. The acquired bearer token to pass. This IFlurlClient or IFlurlRequest. Encapsulates request, response, and other details associated with an HTTP call. Useful for diagnostics and available in global event handlers and FlurlHttpException.Call. The IFlurlRequest associated with this call. The HttpRequestMessage associated with this call. Captured request body. Available ONLY if Request.Content is a Flurl.Http.Content.CapturedStringContent. HttpResponseMessage associated with the call if the call completed, otherwise null. Exception that occurred while sending the HttpRequestMessage. User code should set this to true inside global event handlers (OnError, etc) to indicate that the exception was handled and should not be propagated further. DateTime the moment the request was sent. DateTime the moment a response was received. Total duration of the call if it completed, otherwise null. True if a response was received, regardless of whether it is an error status. True if a response with a successful HTTP status was received. HttpStatusCode of the response if the call completed, otherwise null. Returns the verb and absolute URI associated with this call. Wrapper class for treating HttpRequestMessage and HttpResponseMessage uniformly. (Unfortunately they don't have a common interface.) Extension methods off HttpRequestMessage. Set a header on this HttpRequestMessage (default), or its Content property if it's a known content-level header. No validation. Overwrites any existing value(s) for the header. The HttpRequestMessage. The header name. The header value. If it's a content-level header and there is no content, this determines whether to create an empty HttpContent or just ignore the header. Gets the value of a header on this HttpRequestMessage (default), or its Content property. Returns null if the header doesn't exist. The HttpRequestMessage. The header name. The header value. Associate an HttpCall object with this request Get the HttpCall assocaited with this request, if any. Extension methods off HttpResponseMessage, and async extension methods off Task<HttpResponseMessage> that allow chaining off methods like SendAsync without the need for nested awaits. Deserializes JSON-formatted HTTP response body to object of type T. Intended to chain off an async HTTP. A type whose structure matches the expected JSON response. A Task whose result is an object containing data in the response body. x = await url.PostAsync(data).ReceiveJson<T>() Condition. Deserializes JSON-formatted HTTP response body to a dynamic object. Intended to chain off an async call. A Task whose result is a dynamic object containing data in the response body. d = await url.PostAsync(data).ReceiveJson() Condition. Deserializes JSON-formatted HTTP response body to a list of dynamic objects. Intended to chain off an async call. A Task whose result is a list of dynamic objects containing data in the response body. d = await url.PostAsync(data).ReceiveJsonList() Condition. Returns HTTP response body as a string. Intended to chain off an async call. A Task whose result is the response body as a string. s = await url.PostAsync(data).ReceiveString() Returns HTTP response body as a stream. Intended to chain off an async call. A Task whose result is the response body as a stream. stream = await url.PostAsync(data).ReceiveStream() Returns HTTP response body as a byte array. Intended to chain off an async call. A Task whose result is the response body as a byte array. bytes = await url.PostAsync(data).ReceiveBytes() Set a header on this HttpResponseMessage (default), or its Content property if it's a known content-level header. No validation. Overwrites any existing value(s) for the header. The HttpResponseMessage. The header name. The header value. If it's a content-level header and there is no content, this determines whether to create an empty HttpContent or just ignore the header. Gets the value of a header on this HttpResponseMessage (default), or its Content property. Returns null if the header doesn't exist. The HttpResponseMessage. The header name. The header value. The status range parser class. Determines whether the specified pattern is match. The pattern. The value. pattern is invalid. Determines whether the specified pattern is match. The pattern. The value. is invalid. Defines stateful aspects (headers, cookies, etc) common to both IFlurlClient and IFlurlRequest Gets or sets the FlurlHttpSettings object used by this client. Collection of headers sent on all requests using this client. Collection of HttpCookies sent and received with all requests using this client. Fluent extension menthods for sending multipart/form-data requests. Sends an asynchronous multipart/form-data POST request. A delegate for building the content parts. The IFlurlRequest. The token to monitor for cancellation requests. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous multipart/form-data POST request. A delegate for building the content parts. The URL. The token to monitor for cancellation requests. A Task whose result is the received HttpResponseMessage. Creates a FlurlRequest from the URL and sends an asynchronous multipart/form-data POST request. A delegate for building the content parts. The URL. The token to monitor for cancellation requests. A Task whose result is the received HttpResponseMessage. Fluent extension methods for tweaking FlurlHttpSettings Change FlurlHttpSettings for this IFlurlClient. The IFlurlClient. Action defining the settings changes. The IFlurlClient with the modified Settings Change FlurlHttpSettings for this IFlurlRequest. The IFlurlRequest. Action defining the settings changes. The IFlurlRequest with the modified Settings Fluently specify the IFlurlClient to use with this IFlurlRequest. The IFlurlRequest. The IFlurlClient to use when sending the request. A new IFlurlRequest to use in calling the Url Fluently returns a new IFlurlRequest that can be used to call this Url with the given client. The IFlurlClient to use to call the Url. A new IFlurlRequest to use in calling the Url Fluently returns a new IFlurlRequest that can be used to call this Url with the given client. The IFlurlClient to use to call the Url. A new IFlurlRequest to use in calling the Url Sets the timeout for this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. Time to wait before the request times out. This IFlurlClient or IFlurlRequest. Sets the timeout for this IFlurlRequest or all requests made with this IFlurlClient. The IFlurlClient or IFlurlRequest. Seconds to wait before the request times out. This IFlurlClient or IFlurlRequest. Adds a pattern representing an HTTP status code or range of codes which (in addition to 2xx) will NOT result in a FlurlHttpException being thrown. The IFlurlClient or IFlurlRequest. Examples: "3xx", "100,300,600", "100-299,6xx" This IFlurlClient or IFlurlRequest. Adds an which (in addition to 2xx) will NOT result in a FlurlHttpException being thrown. The IFlurlClient or IFlurlRequest. Examples: HttpStatusCode.NotFound This IFlurlClient or IFlurlRequest. Prevents a FlurlHttpException from being thrown on any completed response, regardless of the HTTP status code. This IFlurlClient or IFlurlRequest. An HTTP message handler that prevents actual HTTP calls from being made and instead returns responses from a provided response factory. Sends the request asynchronous. The request. The token to monitor for cancellation requests. An exception thrown by HttpTest's assertion methods to indicate that the assertion failed. Initializes a new instance of the class. The expected call conditions. The expected number of calls. The actual number calls. Provides fluent helpers for asserting against (faked) HTTP calls. This class is normally not instantiated directly; you can get an instance via HttpTest.ShouldHaveCalled or HttpTest.ShouldNotHaveCalled Set of calls (usually from HttpTest.CallLog) to assert against. if true, assertions pass when calls matching criteria were NOT made. Assert whether calls matching specified criteria were made a specific number of times. (When not specified, assertions verify whether any calls matching criteria were made.) Exact number of expected calls must be greater than or equal to 0. Asserts whether calls were made matching given URL or URL pattern. Can contain * wildcard. Asserts whether calls were made containing the given query parameter (regardless of its value). The query parameter name. Asserts whether calls were made NOT containing the given query parameter. The query parameter name. Asserts whether calls were made containing all the given query parameters (regardless of their values). The query parameter names. Asserts whether calls were made NOT containing ANY of the given query parameters. The query parameter names. Asserts whether calls were made containing the given query parameter name and value. The query parameter name. The query parameter value. Can contain * wildcard. Asserts whether calls were made NOT containing the given query parameter name and value. The query parameter name. The query parameter value. Can contain * wildcard. Asserts whether calls were made containing all of the given query parameter values. Object (usually anonymous) or dictionary that is parsed to name/value query parameters to check for. Asserts whether calls were made NOT containing ANY of the given query parameter values. Object (usually anonymous) or dictionary that is parsed to name/value query parameters to check for. Asserts whether calls were made containing given request body or request body pattern. Can contain * wildcard. Asserts whether calls were made containing given JSON-encoded request body. Asserts whether calls were made containing given URL-encoded request body. Asserts whether calls were made with given HTTP verb. Asserts whether calls were made with a request body of the given content (MIME) type. Asserts whether the Authorization header was set with OAuth. Expected token value Asserts whther the calls were made containing the given request header. Expected header name Expected header value pattern Asserts whther the calls were made that do not contain the given request header. Expected header name Expected header value pattern Asserts whether the Authorization header was set with basic auth. Expected username Expected password Asserts whether calls were made matching the given predicate function. Predicate (usually a lambda expression) that tests an HttpCall and returns a bool. Asserts whether calls were made that do NOT match the given predicate function. Predicate (usually a lambda expression) that tests an HttpCall and returns a bool. An object whose existence puts Flurl.Http into test mode where actual HTTP calls are faked. Provides a response queue, call log, and assertion helpers for use in Arrange/Act/Assert style tests. Initializes a new instance of the class. A delegate callback throws an exception. Gets or sets the FlurlHttpSettings object used by this test. Gets the current HttpTest from the logical (async) call context Queue of HttpResponseMessages to be returned in place of real responses during testing. List of all (fake) HTTP calls made since this HttpTest was created. Change FlurlHttpSettings for the scope of this HttpTest. Action defining the settings changes. This HttpTest Adds an HttpResponseMessage to the response queue. The simulated response body string. The simulated HTTP status. Default is 200. The simulated response headers (optional). The simulated response cookies (optional). If true, underscores in property names of headers will be replaced by hyphens. Default is true. The current HttpTest object (so more responses can be chained). Adds an HttpResponseMessage to the response queue with the given data serialized to JSON as the content body. The object to be JSON-serialized and used as the simulated response body. The simulated HTTP status. Default is 200. The simulated response headers (optional). The simulated response cookies (optional). If true, underscores in property names of headers will be replaced by hyphens. Default is true. The current HttpTest object (so more responses can be chained). Adds an HttpResponseMessage to the response queue. The simulated response body content (optional). The simulated HTTP status. Default is 200. The simulated response headers (optional). The simulated response cookies (optional). If true, underscores in property names of headers will be replaced by hyphens. Default is true. The current HttpTest object (so more responses can be chained). Adds a simulated timeout response to the response queue. Asserts whether matching URL was called, throwing HttpCallAssertException if it wasn't. URL that should have been called. Can include * wildcard character. Asserts whether matching URL was NOT called, throwing HttpCallAssertException if it was. URL that should not have been called. Can include * wildcard character. Asserts whether any HTTP call was made, throwing HttpCallAssertException if none were. Asserts whether no HTTP calls were made, throwing HttpCallAssertException if any were. Releases unmanaged and - optionally - managed resources. IHttpClientFactory implementation used to fake and record calls in tests. Creates an instance of FakeHttpMessageHander, which prevents actual HTTP calls from being made. URL builder extension methods on FlurlRequest Appends a segment to the URL path, ensuring there is one and only one '/' character as a seperator. The IFlurlRequest associated with the URL The segment to append If true, URL-encodes reserved characters such as '/', '+', and '%'. Otherwise, only encodes strictly illegal characters (including '%' but only when not followed by 2 hex characters). This IFlurlRequest is . Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a seperator. The IFlurlRequest associated with the URL The segments to append This IFlurlRequest Appends multiple segments to the URL path, ensuring there is one and only one '/' character as a seperator. The IFlurlRequest associated with the URL The segments to append This IFlurlRequest Adds a parameter to the URL query, overwriting the value if name exists. The IFlurlRequest associated with the URL Name of query parameter Value of query parameter Indicates how to handle null values. Defaults to Remove (any existing) This IFlurlRequest Adds a parameter to the URL query, overwriting the value if name exists. The IFlurlRequest associated with the URL Name of query parameter Value of query parameter Set to true to indicate the value is already URL-encoded Indicates how to handle null values. Defaults to Remove (any existing) This IFlurlRequest is . Adds a parameter without a value to the URL query, removing any existing value. The IFlurlRequest associated with the URL Name of query parameter This IFlurlRequest Parses values (usually an anonymous object or dictionary) into name/value pairs and adds them to the URL query, overwriting any that already exist. The IFlurlRequest associated with the URL Typically an anonymous object, ie: new { x = 1, y = 2 } Indicates how to handle null values. Defaults to Remove (any existing) This IFlurlRequest Adds multiple parameters without values to the URL query. The IFlurlRequest associated with the URL Names of query parameters. This IFlurlRequest Adds multiple parameters without values to the URL query. The IFlurlRequest associated with the URL Names of query parameters This IFlurlRequest Removes a name/value pair from the URL query by name. The IFlurlRequest associated with the URL Query string parameter name to remove This IFlurlRequest Removes multiple name/value pairs from the URL query by name. The IFlurlRequest associated with the URL Query string parameter names to remove This IFlurlRequest Removes multiple name/value pairs from the URL query by name. The IFlurlRequest associated with the URL Query string parameter names to remove This IFlurlRequest Set the URL fragment fluently. The IFlurlRequest associated with the URL The part of the URL afer # This IFlurlRequest Removes the URL fragment including the #. The IFlurlRequest associated with the URL This IFlurlRequest