Commit 11c30fce authored by Sergio Bertolín's avatar Sergio Bertolín Committed by Thomas Müller
Browse files

Changed request to not add a prefix to the url (#26256)

* Changed request to not add a prefix to the url

* Expecting forbidden instead of service unavailable

* Handling login exceptions
parent 9ebf8c09
......@@ -145,6 +145,15 @@ trait BasicStructure {
}
}
/**
* @When /^sending "([^"]*)" with exact url to "([^"]*)"$/
* @param string $verb
* @param string $url
*/
public function sendingToDirectUrl($verb, $url) {
$this->sendingToWithDirectUrl($verb, $url, null);
}
public function sendingToWithDirectUrl($verb, $url, $body) {
$fullUrl = substr($this->baseUrl, 0, -5) . $url;
$client = new Client();
......
......@@ -558,7 +558,7 @@ Feature: provisioning
Given As an "admin"
And user "user0" exists
And As an "user0"
When sending "GET" to "/index.php/apps/files"
When sending "GET" with exact url to "/index.php/apps/files"
Then the HTTP status code should be "200"
Scenario: Making a web request with a disabled user
......@@ -566,7 +566,6 @@ Feature: provisioning
And user "user0" exists
And assure user "user0" is disabled
And As an "user0"
When sending "GET" to "/index.php/apps/files"
Then the OCS status code should be "999"
And the HTTP status code should be "200"
When sending "GET" with exact url to "/index.php/apps/files"
And the HTTP status code should be "403"
......@@ -47,6 +47,9 @@ try {
} catch (\OC\HintException $ex) {
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
} catch (\OC\User\LoginException $ex) {
OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN);
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
} catch (Exception $ex) {
try {
\OC::$server->getLogger()->logException($ex, ['app' => 'index']);
......
......@@ -32,6 +32,7 @@ class OC_Response {
const STATUS_NOT_MODIFIED = 304;
const STATUS_TEMPORARY_REDIRECT = 307;
const STATUS_BAD_REQUEST = 400;
const STATUS_FORBIDDEN = 403;
const STATUS_NOT_FOUND = 404;
const STATUS_INTERNAL_SERVER_ERROR = 500;
const STATUS_SERVICE_UNAVAILABLE = 503;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment