mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Setting Content-Type to text/plain in various error responses for RestfulServer (from r114750)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@114751 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
25da2d1c25
commit
452d87d918
@ -549,22 +549,26 @@ class RestfulServer extends Controller {
|
|||||||
// return a 401
|
// return a 401
|
||||||
$this->getResponse()->setStatusCode(401);
|
$this->getResponse()->setStatusCode(401);
|
||||||
$this->getResponse()->addHeader('WWW-Authenticate', 'Basic realm="API Access"');
|
$this->getResponse()->addHeader('WWW-Authenticate', 'Basic realm="API Access"');
|
||||||
|
$this->getResponse()->addHeader('Content-Type', 'text/plain');
|
||||||
return "You don't have access to this item through the API.";
|
return "You don't have access to this item through the API.";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function notFound() {
|
protected function notFound() {
|
||||||
// return a 404
|
// return a 404
|
||||||
$this->getResponse()->setStatusCode(404);
|
$this->getResponse()->setStatusCode(404);
|
||||||
|
$this->getResponse()->addHeader('Content-Type', 'text/plain');
|
||||||
return "That object wasn't found";
|
return "That object wasn't found";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function methodNotAllowed() {
|
protected function methodNotAllowed() {
|
||||||
$this->getResponse()->setStatusCode(405);
|
$this->getResponse()->setStatusCode(405);
|
||||||
|
$this->getResponse()->addHeader('Content-Type', 'text/plain');
|
||||||
return "Method Not Allowed";
|
return "Method Not Allowed";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function unsupportedMediaType() {
|
protected function unsupportedMediaType() {
|
||||||
$this->response->setStatusCode(415); // Unsupported Media Type
|
$this->response->setStatusCode(415); // Unsupported Media Type
|
||||||
|
$this->getResponse()->addHeader('Content-Type', 'text/plain');
|
||||||
return "Unsupported Media Type";
|
return "Unsupported Media Type";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user