FIX text/json is not a valid mimetype

This commit is contained in:
Daniel Hensby 2018-08-15 12:10:39 +01:00
parent 3b06385b7d
commit d9154bffbf
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
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());