Skip to content

Commit 8e0e207

Browse files
committed
Converted to Modern ObjC syntax.
Added podspec in the repo to easily `pod push`
1 parent 3e85cfe commit 8e0e207

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

OHHTTPStubs.podspec

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Pod::Spec.new do |s|
2+
s.name = "OHHTTPStubs"
3+
s.version = "2.2.1"
4+
s.summary = "Stubbing framework for network requests."
5+
s.description = <<-DESC
6+
A class to stub network requests easily:
7+
* Test your apps with fake network data (stubbed from file)
8+
* Use customized stubs depending on the requests
9+
* Use custom response time to simulate slow network.
10+
11+
> **WARNING**: Don't forget to remove stubs before submitting to the AppStore!
12+
> You should use `OHHTTPStubs` only for your Unit Test targets or while in development
13+
> (for example between `#ifdef DEBUG`/`#endif`).
14+
DESC
15+
s.homepage = "https://github.com/AliSoftware/OHHTTPStubs"
16+
s.license = "MIT"
17+
s.authors = { 'Olivier Halligon' => 'olivier.halligon+ae@gmail.com' }
18+
19+
s.source = { :git => "https://github.com/AliSoftware/OHHTTPStubs.git", :tag => s.version.to_s }
20+
s.source_files = "OHHTTPStubs"
21+
s.public_header_files = "OHHTTPStubs/*.h"
22+
s.frameworks = 'Foundation', 'CFNetwork'
23+
24+
s.requires_arc = true
25+
s.ios.deployment_target = '5.0'
26+
s.osx.deployment_target = '10.7'
27+
end

OHHTTPStubs/OHHTTPStubs.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ - (void)startLoading
283283
}
284284

285285

286-
NSString* redirectLocation = [responseStub.httpHeaders objectForKey:@"Location"];
286+
NSString* redirectLocation = (responseStub.httpHeaders)[@"Location"];
287287
NSURL* redirectLocationURL;
288288
if (redirectLocation)
289289
{

OHHTTPStubs/OHHTTPStubsResponse+HTTPMessage.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ +(instancetype)responseWithHTTPMessageData:(NSData*)responseData;
1616
{
1717
NSData *data = [NSData data];
1818
NSInteger statusCode = 200;
19-
NSDictionary *headers = [NSDictionary dictionary];
19+
NSDictionary *headers = @{};
2020

2121
CFHTTPMessageRef httpMessage = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, FALSE);
2222
if (httpMessage)

OHHTTPStubs/OHHTTPStubsResponse.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ -(instancetype)initWithInputStream:(NSInputStream*)inputStream
114114
self.dataSize = dataSize;
115115
self.statusCode = statusCode;
116116
NSMutableDictionary * headers = [NSMutableDictionary dictionaryWithDictionary:httpHeaders];
117-
[headers setObject:[NSString stringWithFormat:@"%llu",self.dataSize] forKey:@"Content-Length"];
117+
headers[@"Content-Length"] = [NSString stringWithFormat:@"%llu",self.dataSize];
118118
self.httpHeaders = [NSDictionary dictionaryWithDictionary:headers];
119119
}
120120
return self;

OHHTTPStubs/UnitTests/Test Suites/NSURLConnectionDelegateTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ -(void)test_NSURLConnection_cookies
210210
return YES;
211211
} withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
212212
NSString* cookie = [NSString stringWithFormat:@"%@=%@;", cookieName, cookieValue];
213-
NSDictionary* headers = [NSDictionary dictionaryWithObject:cookie forKey:@"Set-Cookie"];
213+
NSDictionary* headers = @{@"Set-Cookie": cookie};
214214
return [[OHHTTPStubsResponse responseWithData:[@"Yummy cookies" dataUsingEncoding:NSUTF8StringEncoding]
215215
statusCode:200
216216
headers:headers]

0 commit comments

Comments
 (0)