Merge pull request #8327 from dhensby/pulls/4/application-json

FIX text/json is not a valid mimetype
This commit is contained in:
Robbie Averill 2018-08-19 13:42:27 +12:00 committed by GitHub
commit 735c87b709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -103,7 +103,7 @@ class PjaxResponseNegotiator
}
}
$response->setBody(Convert::raw2json($responseParts));
$response->addHeader('Content-Type', 'text/json');
$response->addHeader('Content-Type', 'application/json');
return $response;
}

View File

@ -263,7 +263,7 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF
}
Config::unnest();
$response = new HTTPResponse(Convert::array2json($json));
$response->addHeader('Content-Type', 'text/json');
$response->addHeader('Content-Type', 'application/json');
return $response;
}

View File

@ -62,7 +62,7 @@ class PjaxResponseNegotiatorTest extends SapphireTest
$request = new HTTPRequest('GET', '/');
$request->setSession(new Session([]));
$request->addHeader('X-Pjax', 'myfragment,otherfragment');
$request->addHeader('Accept', 'text/json');
$request->addHeader('Accept', 'application/json');
$response = $negotiator->respond($request);
$json = json_decode($response->getBody());
$this->assertObjectHasAttribute('myfragment', $json);
@ -87,7 +87,7 @@ class PjaxResponseNegotiatorTest extends SapphireTest
$request = new HTTPRequest('GET', '/');
$request->setSession(new Session([]));
$request->addHeader('X-Pjax', 'alpha');
$request->addHeader('Accept', 'text/json');
$request->addHeader('Accept', 'application/json');
$response = $negotiator->setFragmentOverride(array('beta'))->respond($request);
$json = json_decode($response->getBody());