Latest 1.0.5
License MIT
Platforms ios 8.0, requires ARC
Dependencies PEObjc-Commons, KissXML, PEXML-Utils, OHHTTPStubs

Build Status

An iOS static library for the easy stubbing of HTTP responses using simple XML
configuration files. PEWire-Control is built on top of the excellent
OHHTTPStubs iOS library.

PEWire-Control is part of the
PE* iOS Library Suite.

Table of Contents

Typical Usage Example

The typical use case for using PEWire-Control will be in the context of unit testing. Imagine you have a unit test that exercises code that invokes some web service.

1) Create the XML file representing a possible response from the web service

You’ll typically want to create a physical folder within your tests source folder; call it something like "http-mock-responses". In Xocde, add this folder as a "reference folder" within your "Supporting Files" group within your tests group in Xcode. Create your mock response XML files within your http-mock-responses/ folder.

<?xml version="1.0" encoding="UTF-8" ?>
<http-response statusCode="200">
  <annotation name="fetch success" host="" port="80" scheme="http" uri-path="/fp/users"
              request-method="GET">Successful fetch of user.</annotation>
    <header name="Content-Type" value="application/" />
    <header name="Last-Modified" value="Tue, 02 Sep 2014 8:03:12 GMT" />
    <header name="fp-auth-token" value="1092348123049OLSDFJLIE001234" />
    <cookie name="cookie1"
            value="some value"
            expires="Sat, 16-Nov-2015 15:00:00 GMT" />
      { "fpuser/name": "Paul Evans",
        "fpuser/email": "[email protected]",
        "fpuser/username": "evansp2",
        "fpuser/creation-date": "Tue, 02 Sep 2014 8:03:12 GMT",
        "_links": {
          "vehicles": {
            "href": "",
            "type": "application/"},
          "fuelpurchase-logs": {
            "href": "",
            "type": "application/"}}}

Save this file as "fetch-user-success.xml" within your http-mock-responses/ folder.

2) In your unit test setup code, do the following:
// Get the path to our mock HTTP response XML file.
NSBundle *testBundle = [NSBundle bundleForClass:[self class]];
NSString *path = [testBundle pathForResource:@"fetch-user-success"
// Fake out Cocoa's URL loading system such that it will return an HTTP response as
// defined in our XML file for any GET requests to:  And,
// simulate a request latency of 5 seconds.
NSError *err;
NSStringEncoding encoding;
[PEHttpResponseSimulator simulateResponseFromXml:[NSString stringWithContentsOfFile:path

Installation with CocoaPods

pod 'PEWire-Control', '~> 1.0.5'

PE* iOS Library Suite

(Each library is implemented as a CocoaPod-enabled iOS static library.)

Latest podspec

    "name": "PEWire-Control",
    "version": "1.0.5",
    "license": "MIT",
    "summary": "An iOS library for the easy stubbing of HTTP responses using simple XML files.",
    "authors": {
        "Paul Evans": "[email protected]"
    "homepage": "",
    "source": {
        "git": "",
        "tag": "PEWire-Control-v1.0.5"
    "platforms": {
        "ios": "8.0"
    "source_files": "**/*.{h,m}",
    "public_header_files": "**/*.h",
    "exclude_files": "**/*Tests/*.*",
    "requires_arc": true,
    "dependencies": {
        "PEObjc-Commons": [
            "~> 1.0.86"
        "KissXML": [
            "~> 5.0"
        "PEXML-Utils": [
            "~> 1.0.4"
        "OHHTTPStubs": [
            "~> 3.1.10"
    "xcconfig": {
        "HEADER_SEARCH_PATHS": ""$(SDKROOT)/usr/include/libxml2""

Pin It on Pinterest

Share This