req package:http-client

Request body to be sent to the server. Since 0.1.0
Convert a URI into a Request. This can fail if the given URI is not absolute, or if the URI scheme is not "http" or "https". In these cases the function will throw an error via MonadThrow. This function defaults some of the values in Request, such as setting method to GET and requestHeaders to []. A Request created by this function won't cause exceptions on non-2XX response status codes.
Same as requestFromURI, but if the conversion would fail, throws an impure exception.
Custom HTTP request headers The Content-Length and Transfer-Encoding headers are set automatically by this module, and shall not be added to requestHeaders. If not provided by the user, Host will automatically be set based on the host and port fields. Moreover, the Accept-Encoding header is set implicitly to gzip for convenience by default. This behaviour can be overridden if needed, by setting the header explicitly to a different value. In order to omit the Accept-Header altogether, set it to the empty string "". If you need an empty Accept-Header (i.e. requesting the identity encoding), set it to a non-empty white-space string, e.g. " ". See RFC 2616 section 14.3 for details about the semantics of the Accept-Header field. If you request a content-encoding not supported by this module, you will have to decode it yourself (see also the decompress field). Note: Multiple header fields with the same field-name will result in multiple header fields being sent and therefore it's the responsibility of the client code to ensure that the rules from RFC 2616 section 4.2 are honoured. Since 0.1.0
HTTP version to send to server. Default: HTTP 1.1 Since 0.4.3
A Manager value that should override whatever Manager value was passed in to the HTTP request function manually. This is useful when dealing with implicit global managers, such as in Network.HTTP.Simple
All information on how to connect to a host and what should be sent in the HTTP request. If you simply wish to download from a URL, see parseRequest. The constructor for this data type is not exposed. Instead, you should use either the defaultRequest value, or parseRequest to construct from a URL, and then use the records below to make modifications. This approach allows http-client to add configuration options without breaking backwards compatibility. For example, to construct a POST request, you could do something like:
initReq <- parseRequest "http://www.example.com/path"
let req = initReq
{ method = "POST"
}
For more information, please see http://www.yesodweb.com/book/settings-types. Since 0.1.0
When using one of the RequestBodyStream / RequestBodyStreamChunked constructors, you must ensure that the GivesPopper can be called multiple times. Usually this is not a problem. The RequestBodyStreamChunked will send a chunked request body. Note that not all servers support this. Only use RequestBodyStreamChunked if you know the server you're sending to supports chunked request bodies. Since 0.1.0
Allows creation of a RequestBody inside the IO monad, which is useful for making easier APIs (like setRequestBodyFile).
Most exceptions are specific to a Request. Inspect the HttpExceptionContent value for details on what occurred.
The given request header is not compliant (e.g. has newlines)
The request body provided did not match the expected size. Provides the expected and actual size.
A default request value, a GET request of localhost/:80, with an empty request body. Note that the default checkResponse does nothing.
Retrieve the orignal Request from a Response Note that the requestBody is not available and always set to empty.
The final request performed. Since 0.4.1
This applies the computeCookieString to a given Request
Perform the given modification to a Request before performing it. This function may be called more than once during request processing. see https://github.com/snoyberg/http-client/issues/350 Default: no modification Since 0.4.4