mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2026-05-31 00:00:10 +08:00
Merge pull request #55 from mstarinteractive/fix-json-content-type
Fix content-types like "application/json; charset=utf-8"
This commit is contained in:
@@ -97,7 +97,8 @@
|
|||||||
|
|
||||||
- (id)jsonObject {
|
- (id)jsonObject {
|
||||||
if (_jsonObject == nil) {
|
if (_jsonObject == nil) {
|
||||||
if ([self.contentType isEqualToString:@"application/json"] || [self.contentType isEqualToString:@"text/json"] || [self.contentType isEqualToString:@"text/javascript"]) {
|
NSString* mimeType = GCDWebServerTruncateHeaderValue(self.contentType);
|
||||||
|
if ([mimeType isEqualToString:@"application/json"] || [mimeType isEqualToString:@"text/json"] || [mimeType isEqualToString:@"text/javascript"]) {
|
||||||
_jsonObject = ARC_RETAIN([NSJSONSerialization JSONObjectWithData:_data options:0 error:NULL]);
|
_jsonObject = ARC_RETAIN([NSJSONSerialization JSONObjectWithData:_data options:0 error:NULL]);
|
||||||
} else {
|
} else {
|
||||||
DNOT_REACHED();
|
DNOT_REACHED();
|
||||||
|
|||||||
Reference in New Issue
Block a user