Skip to content

PMHTTP v3.0.0

Compare
Choose a tag to compare
@lilyball lilyball released this 27 Feb 21:40
· 119 commits to master since this release
  • 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:) to HTTPManagerDataRequest and HTTPManagerActionRequest.
  • 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 whose deinit 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 URLQueryItems 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 and credential properties have been replaced with defaultAuth and auth, using a brand new protocol HTTPAuth. An implementation of Basic authentication is provided with the HTTPBasicAuth object. This new authentication mechanism has been designed to allow for OAuth2-style refreshes, and a helper class HTTPRefreshableAuth is provided to make it easy to implement refreshable authentication.