Problem/Motivation
ContentNegotitation::getContentType() is not checking the format correctly. So basically if you try to do a GET request for a node, requesting for a hal_json format or json, you will receive html instead of the correct format.
Proposed resolution
Obtain the format from the request. I think the tests are working because we add _format directly
// Read it over the REST API.
$response = $this->httpRequest($entity->urlInfo()->setRouteParameter('_format', $this->defaultFormat), 'GET');
$this->assertResponse('200', 'HTTP response code is correct.');
$this->assertHeader('content-type', $this->defaultMimeType);
$data = Json::decode($response);
I'm not sure why we are not obtaining the format... we are trying to obtain the format from the query and not sure if I'm missing something that has been changed and thats why we are doing it...
if ($request->query->has('_format')) {
return $request->query->get('_format');
}
Comments
Comment #3
penyaskitoAre you aware of https://www.drupal.org/node/2501221 ?
Comment #4
marthinal commentedOMG :) Ok I see
Many thanks!!!!