What is PMHTTP?

PMHTTP is an HTTP framework built around URLSession and designed for Swift while retaining Obj-C compatibility.

We think URLSession is great. But it was designed for Obj-C and it doesn’t handle anything beyond the networking aspect of a request. This means no handling of JSON, and it doesn’t even provide multipart/form-data uploads. PMHTTP leaves the networking to URLSession and provides everything else. Features include:

  • Requests can define parse handlers that execute asynchronously separately from the completion block, and requests can be canceled while parsing and the completion block sees the correct result.
  • First-class JSON support using PMJSON.
  • Structured results and high-quality errors; no more treating URLError.cancelled as a network error.
  • Strongly-typed results.
  • Thread safety.
  • Intelligent cache handling.
  • Requests can be defined once (including a parse handler) and executed many times, just like URLRequest.
  • Configurable automatic retrying of failed requests when safe.
  • A configurable base URL, allowing for switching between staging and production with no change to the code constructing the requests.
  • Support for Basic authentication.
  • multipart/form-data, application/x-www-form-urlencoded, and JSON upload support.
  • Built-in request mocking support without using method swizzling.
  • Nothing uses the main thread, not even completion blocks, unless you explicitly ask it to.

Overview

  • Pricing: Free
  • Resource Link: https://github.com/postmates/PMHTTP
  • Resource Maker: Postmates Inc.
  • Mobile Platform Destination: iOS Apps
  • Mobile Platform Support: Native iOS
  • Programming Languages: Swift
  • iOS Versions Supported: iOS 8.0+, iOS 9.0+, iOS 10.0+, iOS 11.0+, iOS 12.0+
  • CocoaPods: PMHTTP
  • Carthage: postmates/PMHTTP