Releases: alexjohnj/Requests
Releases · alexjohnj/Requests
Requests 0.3.1
Requests 0.3
v0.3.0 (2019-07-14)
New
- The
URLSession
perform extension now uses the Result type in the standard
library. - A new
RequestTransportError
type has been introduced. This type makes it
easier to pass around contextual information with an error (e.g., the failing
request, any received response). - Added support for validating the received
HTTPURLResponse
in the
URLSession
perform extension.
API Breaking Changes
- Requests now requires Swift 5.
- The
URLSession
perform extension now uses the Result type in the standard
library. - The
RequestError.invalidRequest
error case has been removed and replaced
with a standaloneInvalidRequestURLError
type. - The
RequestError.nonHTTPResponse
error no longer wraps the receivedURLResponse
Requests 0.2
New
- Added a
BodyProvider
type that can generate the body of a request. This
replaces the raw body data that was previously provided by a
RequestConvertible
type. ABodyProvider
wraps a throwing function that
generates aRequestBody
and updates aHeader
. Built-in body providers are
included for:- JSON bodies
- Plain text bodies
- Stream bodies
- Raw data bodies
- Added an
AuthenticationProvider
type that can add authentication credentials
to the header of a request. AnAuthenticationProvider
wraps a function that
updates aHeader
instance. Built-in authentication providers are included
for:- HTTP Basic authentication.
- Bearer token authentication.
- Added a setter subscript to the
Header
type that can set aField
.
API Breaking Changes
- Requests now requires Swift 4.2
- The
httpBody
property has been removed from theRequestConvertible
protocol. It is replaced by thebodyProvider
property. This will silently
break existing code. - Header fields are now backed by a
CaseInsensitiveString
type instead of a
String
. - The
contentType
andaccept
Field
s now accept aMediaType
instance
instead of a string.