Skip to content

Commit

Permalink
Merge pull request #62 from hpique/master
Browse files Browse the repository at this point in the history
Don't override Content-Length in initializer if already set
  • Loading branch information
AliSoftware committed May 18, 2014
2 parents 233f747 + 2cdaf85 commit 9877c7f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion OHHTTPStubs/Sources/OHHTTPStubsResponse.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ -(instancetype)initWithInputStream:(NSInputStream*)inputStream
self.dataSize = dataSize;
self.statusCode = statusCode;
NSMutableDictionary * headers = [NSMutableDictionary dictionaryWithDictionary:httpHeaders];
headers[@"Content-Length"] = [NSString stringWithFormat:@"%llu",self.dataSize];
static NSString *const ContentLengthHeader = @"Content-Length";
if (!headers[ContentLengthHeader])
{
headers[ContentLengthHeader] = [NSString stringWithFormat:@"%llu",self.dataSize];
}
self.httpHeaders = [NSDictionary dictionaryWithDictionary:headers];
}
return self;
Expand Down

0 comments on commit 9877c7f

Please sign in to comment.