Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Commit

Permalink
Adjusting the content-type header testing to be prefix-based (since t…
Browse files Browse the repository at this point in the history
…he content-type header can have a ; and encoding after the MIME type) and bumping the podspec version to 2.0.3.
  • Loading branch information
vokal-isaac committed Feb 12, 2015
1 parent a28f8f2 commit 4dc7e16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions VOKMockUrlProtocol.m
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ - (NSArray *)resourceNames
NSString *contentType = [self.request valueForHTTPHeaderField:HTTPHeaderContentType];

NSString *bodyString;
if ([HTTPHeaderContentTypeFormUrlencoded isEqualToString:contentType]) {
if ([contentType hasPrefix:HTTPHeaderContentTypeFormUrlencoded]) {
// If it's form-URL-encoded, generate a resource name by appending the body as a string.
bodyString = [[NSString alloc] initWithData:bodyData encoding:NSUTF8StringEncoding];

} else if ([HTTPHeaderContentTypeJson isEqualToString:contentType]) {
} else if ([contentType hasPrefix:HTTPHeaderContentTypeJson]) {
// Otherwise, if it's JSON, generate a resource name by bencoding the JSON datastructure and
// percent-escaping the resulting string.
NSData *bencoded = [VOKBenkode encode:
Expand Down
2 changes: 1 addition & 1 deletion VOKMockUrlProtocol.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "VOKMockUrlProtocol"
s.version = "2.0.2"
s.version = "2.0.3"
s.summary = "A url protocol that parses and returns fake responses with mock data."
s.homepage = "https://github.com/vokal/VOKMockUrlProtocol"
s.license = { :type => "MIT", :file => "LICENSE"}
Expand Down

0 comments on commit 4dc7e16

Please sign in to comment.