|
44 | 44 | NSString * const OCTClientErrorMessagesKey = @"OCTClientErrorMessagesKey";
|
45 | 45 |
|
46 | 46 | 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"; |
48 | 53 |
|
49 | 54 | static const NSInteger OCTClientNotModifiedStatusCode = 304;
|
50 | 55 | static NSString * const OCTClientOneTimePasswordHeaderField = @"X-GitHub-OTP";
|
@@ -241,11 +246,13 @@ - (id)initWithServer:(OCTServer *)server {
|
241 | 246 |
|
242 | 247 | [AFHTTPRequestOperation addAcceptableStatusCodes:[NSIndexSet indexSetWithIndex:OCTClientNotModifiedStatusCode]];
|
243 | 248 |
|
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]; |
246 | 253 |
|
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]]; |
249 | 256 |
|
250 | 257 | self.parameterEncoding = AFJSONParameterEncoding;
|
251 | 258 | [self registerHTTPOperationClass:AFJSONRequestOperation.class];
|
@@ -331,7 +338,7 @@ + (RACSignal *)signInAsUser:(OCTUser *)user password:(NSString *)password oneTim
|
331 | 338 | request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
|
332 | 339 | if (oneTimePassword != nil) [request setValue:oneTimePassword forHTTPHeaderField:OCTClientOneTimePasswordHeaderField];
|
333 | 340 |
|
334 |
| - NSString *previewContentType = [NSString stringWithFormat:@"application/vnd.github.%@+json", OCTClientPreviewAPIVersion]; |
| 341 | + NSString *previewContentType = [NSString stringWithFormat:@"application/vnd.github.%@+json", OCTClientMiragePreviewAPIVersion]; |
335 | 342 | [request setValue:previewContentType forHTTPHeaderField:@"Accept"];
|
336 | 343 |
|
337 | 344 | RACSignal *tokenSignal = [client enqueueRequest:request resultClass:OCTAuthorization.class];
|
|
0 commit comments