mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX text/json is not a valid mimetype
This commit is contained in:
parent
3b06385b7d
commit
d9154bffbf
@ -103,7 +103,7 @@ class PjaxResponseNegotiator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$response->setBody(Convert::raw2json($responseParts));
|
$response->setBody(Convert::raw2json($responseParts));
|
||||||
$response->addHeader('Content-Type', 'text/json');
|
$response->addHeader('Content-Type', 'application/json');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -263,7 +263,7 @@ class GridFieldAddExistingAutocompleter implements GridField_HTMLProvider, GridF
|
|||||||
}
|
}
|
||||||
Config::unnest();
|
Config::unnest();
|
||||||
$response = new HTTPResponse(Convert::array2json($json));
|
$response = new HTTPResponse(Convert::array2json($json));
|
||||||
$response->addHeader('Content-Type', 'text/json');
|
$response->addHeader('Content-Type', 'application/json');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class PjaxResponseNegotiatorTest extends SapphireTest
|
|||||||
$request = new HTTPRequest('GET', '/');
|
$request = new HTTPRequest('GET', '/');
|
||||||
$request->setSession(new Session([]));
|
$request->setSession(new Session([]));
|
||||||
$request->addHeader('X-Pjax', 'myfragment,otherfragment');
|
$request->addHeader('X-Pjax', 'myfragment,otherfragment');
|
||||||
$request->addHeader('Accept', 'text/json');
|
$request->addHeader('Accept', 'application/json');
|
||||||
$response = $negotiator->respond($request);
|
$response = $negotiator->respond($request);
|
||||||
$json = json_decode($response->getBody());
|
$json = json_decode($response->getBody());
|
||||||
$this->assertObjectHasAttribute('myfragment', $json);
|
$this->assertObjectHasAttribute('myfragment', $json);
|
||||||
@ -87,7 +87,7 @@ class PjaxResponseNegotiatorTest extends SapphireTest
|
|||||||
$request = new HTTPRequest('GET', '/');
|
$request = new HTTPRequest('GET', '/');
|
||||||
$request->setSession(new Session([]));
|
$request->setSession(new Session([]));
|
||||||
$request->addHeader('X-Pjax', 'alpha');
|
$request->addHeader('X-Pjax', 'alpha');
|
||||||
$request->addHeader('Accept', 'text/json');
|
$request->addHeader('Accept', 'application/json');
|
||||||
|
|
||||||
$response = $negotiator->setFragmentOverride(array('beta'))->respond($request);
|
$response = $negotiator->setFragmentOverride(array('beta'))->respond($request);
|
||||||
$json = json_decode($response->getBody());
|
$json = json_decode($response->getBody());
|
||||||
|
Loading…
Reference in New Issue
Block a user