Skip to content
This repository was archived by the owner on Dec 4, 2018. It is now read-only.

Commit 1a6667f

Browse files
committed
Merge pull request #240 from octokit/moondragon
Moondragon
2 parents 76c8f6c + 86c563a commit 1a6667f

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

OctoKit/OCTClient.m

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@
4444
NSString * const OCTClientErrorMessagesKey = @"OCTClientErrorMessagesKey";
4545

4646
NSString * const OCTClientAPIVersion = @"v3";
47-
NSString * const OCTClientPreviewAPIVersion = @"mirage-preview";
47+
48+
/// See https://developer.github.com/changes/2014-12-08-removing-authorizations-token/
49+
NSString * const OCTClientMiragePreviewAPIVersion = @"mirage-preview";
50+
51+
/// See https://developer.github.com/changes/2014-12-08-organization-permissions-api-preview/
52+
NSString * const OCTClientMoondragonPreviewAPIVersion = @"moondragon";
4853

4954
static const NSInteger OCTClientNotModifiedStatusCode = 304;
5055
static NSString * const OCTClientOneTimePasswordHeaderField = @"X-GitHub-OTP";
@@ -241,11 +246,13 @@ - (id)initWithServer:(OCTServer *)server {
241246

242247
[AFHTTPRequestOperation addAcceptableStatusCodes:[NSIndexSet indexSetWithIndex:OCTClientNotModifiedStatusCode]];
243248

244-
NSString *stableContentType = [NSString stringWithFormat:@"application/vnd.github.%@+json", OCTClientAPIVersion];
245-
NSString *previewContentType = [NSString stringWithFormat:@"application/vnd.github.%@+json", OCTClientPreviewAPIVersion];
249+
NSString *baseContentType = @"application/vnd.github.%@+json";
250+
NSString *stableContentType = [NSString stringWithFormat:baseContentType, OCTClientAPIVersion];
251+
NSString *previewContentType = [NSString stringWithFormat:baseContentType, OCTClientMiragePreviewAPIVersion];
252+
NSString *moondragonPreviewContentType = [NSString stringWithFormat:baseContentType, OCTClientMoondragonPreviewAPIVersion];
246253

247-
[self setDefaultHeader:@"Accept" value:stableContentType];
248-
[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObjects:stableContentType, previewContentType, nil]];
254+
[self setDefaultHeader:@"Accept" value:moondragonPreviewContentType];
255+
[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObjects:stableContentType, previewContentType, moondragonPreviewContentType, nil]];
249256

250257
self.parameterEncoding = AFJSONParameterEncoding;
251258
[self registerHTTPOperationClass:AFJSONRequestOperation.class];
@@ -331,7 +338,7 @@ + (RACSignal *)signInAsUser:(OCTUser *)user password:(NSString *)password oneTim
331338
request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
332339
if (oneTimePassword != nil) [request setValue:oneTimePassword forHTTPHeaderField:OCTClientOneTimePasswordHeaderField];
333340

334-
NSString *previewContentType = [NSString stringWithFormat:@"application/vnd.github.%@+json", OCTClientPreviewAPIVersion];
341+
NSString *previewContentType = [NSString stringWithFormat:@"application/vnd.github.%@+json", OCTClientMiragePreviewAPIVersion];
335342
[request setValue:previewContentType forHTTPHeaderField:@"Accept"];
336343

337344
RACSignal *tokenSignal = [client enqueueRequest:request resultClass:OCTAuthorization.class];

0 commit comments

Comments
 (0)