Releases: postmates/PMHTTP
Releases · postmates/PMHTTP
PMHTTP v4.1.1
- Add
HTTPHeaders.merge(_:uniquingKeysWith:)
andHTTPHeaders.merging(_:uniquingKeysWith:)
. - Deprecate
HTTPHeaders.append(contentsOf:)
. - Merge header fields when calling
HTTPManagerRequest.setDefaultEnvironmentalProperties()
, giving priority to existing request header fields in the case of a conflict.
PMHTTP v4.1.0
- Support mocking relative URLs when no environment has been set.
- Shrink the default mock delay to 10ms.
- Make
HTTPManagerRequest.headerFields
mutable in Obj-C. - Add
HTTPManager.defaultHeaderFields
which defines the default header fields to attach to requests and, likedefaultAuth
, only applies to requests within the current environment. - Declare conformance to
Equatable
forHTTPManagerRequest.HTTPHeaders
. - Fix fatal error when using deferred multipart bodies along with
serverRequiresContentLength
. - Add
HTTPManager.metricsCallback
to collect task metrics (URLSessionTaskMetrics
) from all tasks associated with theHTTPManager
.
PMHTTP v4.0.1
- Fix
<PMHTTP/PMHTTP.h>
so it can be imported from Obj-C++ code.
PMHTTP v4.0.0
- Convert to Swift 4.
- Add a method
HTTPManagerParseRequest.map(_:)
. - Add methods
HTTPManagerDataRequest.decodeAsJSON(_:with:options:)
andHTTPManagerActionRequest.decodeAsJSON(_:with:options:)
.
PMHTTP v3.0.5
- Extend
HTTPAuth
to support handling 403 Forbidden errors as well.
PMHTTP v3.0.4
- Support Swift 3.2.
- Handle
serverRequiresContentLength
correctly inpreparedURLRequest
.
PMHTTP v3.0.3
- Add overloads to the request creation methods that take a
URL
. These overloads return a non-optional request. - Add new property
HTTPManagerRequest.serverRequiresContentLength
. This disables streaming body support (for JSON and multipart/mixed) and instead encodes the body synchronously so it can provide a"Content-Length"
header to the server. There is a correspondingHTTPManager.defaultServerRequiresContentLength
property as well. - Add a method
HTTPManagerRequest.setDefaultEnvironmentalProperties()
that sets properties to theHTTPManager
-defined defaults that otherwise are only set if the request's path matches the environment. This is primarily intended for requests constructed using absolute paths (e.g.HTTP.request(GET: "/foo")
) that should still use the environment defaults. Right now this method only setsauth
andserverRequiresContentLength
.
PMHTTP v3.0.2
- Add
@discardableResult
to Obj-C-performRequest…
methods.
PMHTTP v3.0.1
- Fix Xcode 8.3 compatibility.
PMHTTP v3.0.0
- Preserve network task priority when retrying tasks.
- Add convenience Obj-C function
PMHTTPErrorIsFailedResponse
to test PMHTTP errors easily. - Add methods
.parseAsImage(scale:)
and.parseAsImage(scale:using:)
toHTTPManagerDataRequest
andHTTPManagerActionRequest
. - When a session is reset, cancel any tasks that were created but never resumed.
- Ensure that the completion block is always deallocated on either the completion queue or on the thread that created the task. Previously there was a very subtle race that meant the completion block could deallocate on the
URLSession
's delegate queue instead. This only matters if your completion block captures values whosedeinit
cares about the current thread. - Expand dictionaries, arrays, and sets passed as parameters. Dictionaries produce keys of the form
"foo[bar]"
and arrays and sets just use the key multiple times (e.g."foo=bar&foo=qux"
). The expansion is recursive. The order of values from expanded dictionaries and sets is implementation-defined. If you want"array[]"
syntax, then put the"[]"
in the key itself. See the documentation comments for more details. Do note that this behavior is slightly different from what AFNetworking does. - Also expand nested
URLQueryItem
s in parameters. The resulting parameter uses dictionary syntax ("foo[bar]"
). - Change the type signature of the Obj-C parse methods that take handlers to make the error parameter non-optional.
- Provide a callback that can be used for session-level authentication challenges. This can be used to implement SSL pinning using something like TrustKit.
- Fix a small memory leak when retrying tasks.
- Rework how authorization works. The
defaultCredential
andcredential
properties have been replaced withdefaultAuth
andauth
, using a brand new protocolHTTPAuth
. An implementation of Basic authentication is provided with theHTTPBasicAuth
object. This new authentication mechanism has been designed to allow for OAuth2-style refreshes, and a helper classHTTPRefreshableAuth
is provided to make it easy to implement refreshable authentication.