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

Commit

Permalink
Fixes creating curl from request with multiple cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
podkovyrin committed Dec 25, 2014
1 parent 74a9c4b commit f2c94df
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions FormatterKit/TTTURLRequestFormatter.m
Expand Up @@ -63,8 +63,12 @@ + (NSString *)cURLCommandFromURLRequest:(NSURLRequest *)request {

if ([request URL]) {
NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[request URL]];
for (NSHTTPCookie *cookie in cookies) {
[command appendCommandLineArgument:[NSString stringWithFormat:@"--cookie \"%@=%@\"", [cookie name], [cookie value]]];
if (cookies.count) {
NSMutableString *cookiesString = [NSMutableString string];
for (NSHTTPCookie *cookie in cookies) {
[cookiesString appendFormat:@"%@=%@;", [cookie name], [cookie value]];
}
[command appendCommandLineArgument:[NSString stringWithFormat:@"--cookie \"%@\"", cookiesString]];
}
}

Expand Down

0 comments on commit f2c94df

Please sign in to comment.