-
Added
pathStartsWith(_:)
to theSwift
helpers.
@sdduursma, #163 -
Added more logging blocks for debugging and better insight into when OHHTTPStubs returns stubs and redirects.
@jzucker2, #161 -
Added matchers that check whether a request has a particular header present, and a matcher to check if a request has a header with a key and value.
@hq-mobile, #160
Note that this last change also changed the signature of the onStubActivation:
(hence the bump to 5.0.0
) so you'll have to update your code if you used this for debugging your stubs.
- Bumps OSX Deployment Target to 10.9 to add Swift support.
@JeanAzzopardi, #154 - Added the
${CURRENT_PROJECT_VERSION}
to theInfo.plist
files of theOHHTTPStubs.framework
so it matches what is expected by iTunes Connect.
@siemensikkema, #140
- Added
isMethodPATCH()
to theSwift
helpers.
@attheodo, #145 - Fixed nullability annotation on
onStubActivation:
method parameter.
@DerLobi, #144
- Added
isMethodGET()
,isMethodPUT()
,isMethodPOST()
andisMethodDELETE()
to theSwift
helpers. (#137)
- Added missing
tvOS
andwatchOS
platforms to theSwift
subspec.
@pantuspavel, #136
4.5.0 — tvOS
- Added support for tvOS.
@tiagomartinho, #134
- Fixed issue with Umbrella Headers.
#127, #131 - Added methods for creating
OHHTTPStubsResponse
s fromNSURL
s that represent file system resources.
@MaxGabriel, #129 - Bumped Swift subspec compatibility to OSX 10.9 instead of 10.7.
- Xcode projects updated to Xcode 7.0 Final
- Added a
Swift
subspec that adds helper global functions to ease & make more compact the use ofOHHTTPStubs
from Swift 2.0 (#111)
If you're using
OHHTTPStubs
in a Swift 2.0 project, it's recommended to addpod 'OHHTTPStubs/Swift
to yourPodfile
so you can use those handy helpers.
- Fix the Examples Xcode project + lib Podfile that were referencing old target names
@mikelupo, #117 - Added two new constants for download speed:
OHHTTPStubsDownloadSpeed1KBPS
= 1kbps andOHHTTPStubsDownloadSpeedSLOW
= 1.5 kpbs.
@mikelupo, #114
4.2.0 — Splitting in subspecs
- The
OHHTTPStubs
spec has been splitted into multiple subspecs:- The default subspec (used when you simply use
pod 'OHHTTPStubs'
in yourPodfile
) contains the subspecsCore
,NSURLSession
,JSON
&OHPathHelpers
(so that it matches the features that most people use). - Other optional subspecs are
HTTPMessage
andMocktail
(which are opt-in because used by much less people). If you want to use them, you'll need to request them explicitly in yourPodfile
usingpod 'OHHTTPStubs/Mocktail
for example.
- The default subspec (used when you simply use
- The iOS Unit Tests are now also run for the framework as well as for the static library, to ensure the tests pass in both contexts (because frameworks sometimes introduce subtleties like when using
NSBundle
, so it's worth testing in that context too) - Added support for stubs written in the Mocktail format.
@JinlianWang, #108
4.1.0 — watchOS 2
- Added support for using
OHHTTPStubs
in watchOS 2.0 targets. - Improved compatibility macros (nullability annotations) — and tested against Xcode 7 beta 4.
- Fix threading in
NSURLProtocol
subclass callingNSURLProtocolClient
callbacks from wrong thread.
@nsprogrammer, #96
4.0.0 — Improvements for Swift
- Annotated the library with nullability attributes to generate a better API when used in Swift
- Migrated the path utility macros to functions in
OHPathHelpers.h
, for Swift compatibility (#100). - Added a complete Swift Demo Project (#88)
- Removed the
XCTestExpectation
subspec that was added for Xcode 5 support — Now that Xcode 6 is widely adopted, you shouldn't need this anymore (but in case you still need it, I will probably create a dedicated pod for that)
- Fixed issue with HTTP 300 return code (multiple-choice) that is not supposed to redirect.
@tarbrain, #92
- Added Carthage support
- Splitted the Xcode projects for more clarity (one dedicated to build the lib and run Unit Tests, and one for the Demo)
- Got rid of the
git submodule
used for Unit Tests against AFNetworking — it is now imported using CocoaPods and only for the lib's Unit Tests targets.
@corinnekrych, #90 - Improved Travis-CI integration. We now use a build matrix to have paralellized and independant builds for each scheme (iOS Static Lib, iOS Dynamic Framework, OSX Framework)
- Fixed #80 again (there was still an issue for people using Xcode 5 & SDK 7.1… if those people still exists)
- Fix headers for people still building with Xcode 5 & SDK 7 (#80)
- Use
NS_DESIGNATED_INITIALIZER
macro on designated initializer methods (#79)
- Use
application/json
instead oftext/json
inREADME
's example (#75) - Fixed an issue with empty files (when using
responseWithFileAtPath:statusCode:headers:
but the file at the specified path is empty)
- Added
DEFINES_MODULE
Flag to be easily imported in Swift (#74)
(I also moved Travis-CI build system so it now uses xcpretty
instead of xctool
to run Unit Tests)
- Fixed issue with the main thread stalling when an
NSException
was raised in the response block - Fixed an issue with
OHHTTPStubs/XCTestExpectation
conditional compilation in Xcode 6.0 & OSX SDK.
(the condition was previously testing available SDKs instead of Xcode version, which led to errors with Xcode 6.0 not having the latest 10.10 SDK yet, but still having theXCTestExpectation
already anyway)
- Migrated Unit Tests to XCTest.
- Added
XCTestExpectation
subspec containing my own implementation for Xcode 5 support
- Fix issue that made stubs never being called on iOS8 (#65).
As of Xcode6 Beta4,
OHHTTPStubs
compatibility with iOS8 has been validated now.
- Fix #66: Use the ivar directly in initialization (to avoid KVO side effects)
- Fix broken link in README (#61)
- Don't override Content-Length header when already set (#62)
- Fixing a crash when using very very long data #57/#59
- Fixing issue #51 regarding a probable race condition when stubs were removed before the request has finished
- Shorten the README.md file and moved all the usage examples in a dedicated wiki page to avoid a endless and frightening README
- The
OHHTTPStubsDescriptor
protocol now inherits from theNSObject
protocol
Fixing issue #47 when stubs were not called, especially when the OHHTTPStubs
pod were loaded both by the application AND the test target/bundle. See also [[A tricky case with Application Tests]].
NSURLSessionConfiguration
's swizzling (to add automatic support ofOHHTTPStubs
toNSURLSession
) is now done in the+load
method of anNSURLSessionConfiguration
category, to be sure it is loaded (and swizzled) only once, even ifOHHTTPStubs
is loaded by two different bundles.- The stubs activation of
NSURLSessionConfiguration
no longer usesobjc_getClass
but uses a call to theOHHTTPStubs
class instead, which ensure that it uses the correctOHHTTPStubs
class in the current bundle instead of always using the one loaded from the main bundle.
- Adding Mac framework & Mac Test Target (#44)
- Adding known limitations in README
- Fixed issue with cookies when
request.URL
isnil
(#39) - Fixed missing
-ObjC
flag in Unit Tests target (that made it unable to call category methods) - Fixed Unit Tests on iOS6 (
NSURLSession
-related Unit Tests now only executed when run on iOS7+ or OSX10.9+, and skipped if targeted for an earlier OS version, asNSURLSession
was not available then)
- Fixed issue with
NSURLSessionConfiguration
auto-swizzling (#37 & #38)
Now
OHHTTPStubs
automagically works withNSURLSessionConfiguration
without the need to enable it for everyNSURLSessionConfiguration
before creating theNSURLSession
: thedefaultSessionConfiguration
andephemeralSessionConfiguration
are now preconfigured automatically to work withOHHTTPStubs
)
- Removed deprecated methods.
The Old API has now totally disappeared, leaving only a clean and simple API without the spam due to old deprecated methods.
Note: If you have already removed the calls to all OHHTTPStubs
deprecated API in your code, you can switch to this 3.0.0
version without any further changes in your code.
- Fixed bug with OHHTTPStubsResponse+JSON when
nil
headers dictionary
- Added the ability to give a name to a stub, for debugging purposes (property
name
ofid<OHHTTPStubsDescriptor>
) - Added
allStubs
method to list all installed stubs (with their name if they have one, see previous point) - Added
+[OHHTTPStubs onStubActivation:]
method to execute arbitrary code each time a stub is activated. Useful to log which stub is used for each request for example.
- Complete refactoring to use
NSInputStream
instead of direct use ofNSData
(Thanks to @kcharwood - #28) - Some other code refactoring to split the code in categories and make it clearer
- Some API changes to make
OHHTTPStubs
to fit the new possibility of setting bothrequestTime
andresponseTime
.- Old API is still there but deprecated, and will be removed in next major version
- To convert to the new API, you will mainly simply:
- extract the
responseTime:
parameter to a method call of its own (return [OHHTTPStubsResponse responseWithData:data statusCode:code responseTime:time headers:header];
will becomereturn [[OHHTTPStubsResponse responseWithData:data statusCode:code headers:headers] responseTime:time];
etc.) - convert
responseWithFile:filename
toresponseWithFileAtPath:OHPathForFileInBundle(filename,nil)
- extract the
Note: version
2.1.0-RC
,2.1.0-rc.1
,2.2.0-RC
and2.2.1-RC
were intermediate Release Candidate versions during the big refactoring and migration to2.2.1
, with the same new features as listed above basicaly, but without the last-minute bugfixes before official release.
- Simplified API
- removed instance methods, no more public
sharedInstance
: directly call class methods on theOHHTTPStubs
class - The old and problematic
addRequestHandler:
method has been deprecated and should not be used anymore. UsestubRequestsPassingTest:withStubResponse:
instead, which is more efficient
- removed instance methods, no more public
- Added API documentation in the headers
- Remove all internal uses of Apple's private APIs
Be careful: if you forgot to remove your use of
OHHTTPStubs
and your stubs from the binary you sent to the AppStore, your app would have been rejected by Apple before 2.0.0, as it was using private API (which was a way to make sure not to forget to remove them), but now it would be accepted silently. So don't forget to remove your stubs andOHHTTPStubs
from your final binary!
- Fixed Deadlock introduced by 1.2.1
- Improved thread-safety (#21)
- Stop sending messages to
NSURLProtoclClient
afterstopLoading
This version is buggy as it introduced a deadlock when performing a request on the main thread. 1.2.2 fixes that issue.
- Added support for "HTTP Message Data" stubs generated with
curl -is <someurl>
to replay them easily (#27). See theREADME.md
for more info - Added redirect support for 3xx response codes (#23)
- Dropped non-ARC support. Now
OHHTTPStubs
is to be compiled using ARC. (This should not change anything as it is intended to be integrated using CocoaPods or compiled in a separate xcodeproj anyway)
Easier integration process:
- Use
#import <OHHTTPStubs/OHHTTPStubs.h>
again - But adding the path to the library headers in your application project's
HEADER_SEARCH_PATH
is no longer needed!
- Fixed crash when calling "setEnabled:" / "registerClass:" multiple times
- New integration process: we don't use the
PortableLibrary.xcconfig
anymore (as it generated problems for people using configuration with names other than "Debug" and "Release"). (1)
You will now have to indicate the folder containing headers for OHHTTPStubs
in your HEADER_SEARCH_PATH
Build Settings, and we are back to #import "OHHTTPStubs.h"
until a better solution is found
(1) This modification for the integration process did only last for version 1.1.1. Version 1.1.2 restored
#import <OHHTTPStubs/OHHTTPStubs.h>
(but using a much better solution than the previous xcconfig used) and fillingHEADER_SEARCH_PATH
is no longer needed in further versions. See changelog for 1.1.2 above.
- Added new API
shouldStubRequest:withRequestHandler:
to avoid useless building of stubbed response likeaddRequestHandler:
does
- Adding support for cookies (Set-Cookie headers)
- Added Unit Tests
- Removed calls to the deprecated
dispatch_get_current_queue()
GCD function (was used withdispatch_after
to add fake delay to stubbed responses)
- Fixed #6 : "responseWithError:" released response object too soon
- Fixed small compilation issues #4 (issue in sample code) & #5 (ARC invalid cast)
- Embedded
OHHTTPStubs
in a neat static library for nicer integration in your Xcode4 workspaces.
- Fix issue when used in a SenTestCase
- Cleaning API, added
removeLastHandler
andremoveRequestHandler:
method. - Now first stable API in this version.
- Example project now compatible with ARC and non-ARC environments
- Added Example project
- Added ARC support
- Some fixes
- Initial version