Skip to content

Commit

Permalink
MINOR Setting Content-Type to text/plain in various error responses f…
Browse files Browse the repository at this point in the history
…or RestfulServer

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@114750 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed Dec 9, 2010
1 parent f61a307 commit e4a786e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/RestfulServer.php
Expand Up @@ -549,22 +549,26 @@ protected function permissionFailure() {
// return a 401
$this->getResponse()->setStatusCode(401);
$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.";
}

protected function notFound() {
// return a 404
$this->getResponse()->setStatusCode(404);
$this->getResponse()->addHeader('Content-Type', 'text/plain');
return "That object wasn't found";
}

protected function methodNotAllowed() {
$this->getResponse()->setStatusCode(405);
$this->getResponse()->addHeader('Content-Type', 'text/plain');
return "Method Not Allowed";
}

protected function unsupportedMediaType() {
$this->response->setStatusCode(415); // Unsupported Media Type
$this->getResponse()->addHeader('Content-Type', 'text/plain');
return "Unsupported Media Type";
}

Expand Down

0 comments on commit e4a786e

Please sign in to comment.