http-exchange-0.2.0.1: Perform HTTP Requests
Safe HaskellSafe-Inferred
LanguageGHC2021

Exchange

Synopsis

Documentation

data Exception Source #

An exception that occurs during an HTTP exchange.

Constructors

Http !HttpException

The response was not a valid HTTP response

Send !SendException

Transport exception while sending. When backed by stream sockets, exceptions like ECONNRESET show up here.

Receive !ReceiveException

Transport exception while receiving. Depending on the backend, this may or may not include an end-of-input exception. For stream sockets, end-of-input is not presented as an exception. It is presented as a zero-length result.

Instances

Instances details
Exception Exception Source # 
Instance details

Defined in Exchange

Show Exception Source # 
Instance details

Defined in Exchange

exchange :: Resource -> Bodied Request -> M (Either Exception (Bodied Response)) Source #

Send an HTTP request and await a response. This function takes responsibility for encoding the request and decoding the response. It deals with the Transfer-Encoding of the response and supports both chunked and nonchunked responses.

exchangeDiscardBody :: Resource -> Bodied Request -> M (Either Exception Response) Source #

Variant of exchange that discards the response body. This can be used safely even when the size of the response body is greater than the amount of memory available.

This is intended as a resident-memory optimization for situations where the caller ignores the response body.