Skip to content

Commit

Permalink
Inserido token no http header
Browse files Browse the repository at this point in the history
  • Loading branch information
aleufms committed Jan 30, 2013
1 parent e7c02bb commit a28d037
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions SDWebImage/SDWebImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ - (NSInteger)maxConcurrentDownloads
request.HTTPShouldHandleCookies = NO;
request.HTTPShouldUsePipelining = YES;
[request addValue:@"image/*" forHTTPHeaderField:@"Accept"];

[request addValue:@"application/json" forHTTPHeaderField:@"Accept-Language"];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"X_BBM_API_KEY"])
[request addValue:[defaults objectForKey:@"X_BBM_API_KEY"] forHTTPHeaderField:@"X_BBM_API_KEY"];

operation = [SDWebImageDownloaderOperation.alloc initWithRequest:request queue:wself.workingQueue options:options progress:^(NSUInteger receivedSize, long long expectedSize)
{
if (!wself) return;
Expand Down

1 comment on commit a28d037

@johndpope
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

johndpope@3396ce6

I created this helper to set the headers

[SDWebImageDownloader setDefaultHeader:(NSString *)header value:(NSString *)value]

Please sign in to comment.