Skip to content

Commit 976cf50

Browse files
committed
Merge branch 'feature/header-accept-type' into develop
2 parents ddbea2d + 55e4e3d commit 976cf50

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Sources/OAuth2Client/NXOAuth2Client.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extern NSString * const NXOAuth2ClientConnectionContextTokenRefresh;
6767

6868
@property (nonatomic, copy) NSSet *desiredScope;
6969
@property (nonatomic, copy) NSString *userAgent;
70+
@property (nonatomic, copy) NSString *acceptType; // defaults to application/json
7071

7172
@property (nonatomic, strong) NXOAuth2AccessToken *accessToken;
7273
@property (nonatomic, unsafe_unretained) NSObject<NXOAuth2ClientDelegate>* delegate;

Sources/OAuth2Client/NXOAuth2Client.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ - (id)initWithClientID:(NSString *)aClientId
9191
tokenType = [aTokenType copy];
9292
accessToken = anAccessToken;
9393

94+
self.acceptType = @"application/json";
95+
9496
self.persistent = shouldPersist;
9597
self.delegate = aDelegate;
9698
}

Sources/OAuth2Client/NXOAuth2Connection.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ - (NSURLConnection *)createConnection;
197197
[startRequest setValue:client.userAgent forHTTPHeaderField:@"User-Agent"];
198198
}
199199

200+
if (client.acceptType) {
201+
[startRequest setValue:client.acceptType forHTTPHeaderField:@"Accept"];
202+
}
203+
200204
NSURLConnection *aConnection = [[NSURLConnection alloc] initWithRequest:startRequest delegate:self startImmediately:NO]; // don't start yet
201205
[aConnection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; // let's first schedule it in the current runloop. (see http://github.com/soundcloud/cocoa-api-wrapper/issues#issue/2 )
202206
[aConnection start]; // now start

0 commit comments

Comments
 (0)