1
0
Fork 0

fix HTTP response code for HTTP 503 (#4610)

This commit is contained in:
Jan 2018-02-19 08:35:02 +01:00 committed by GitHub
parent 3434125c76
commit aba64939e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -173,6 +173,8 @@ static std::string FixEndpointProto(std::string const& endpoint) {
}
static void writeError(int code, GeneralResponse* response) {
response->setResponseCode(GeneralResponse::responseCode(code));
VPackBuffer<uint8_t> buffer;
VPackBuilder builder(buffer);
builder.add(VPackValue(VPackValueType::Object));
@ -187,7 +189,6 @@ static void writeError(int code, GeneralResponse* response) {
response->setPayload(std::move(buffer), true, VPackOptions::Defaults);
}
/// @brief fill a response object with correct response for a follower
void ReplicationFeature::prepareFollowerResponse(GeneralResponse* response,
arangodb::ServerState::Mode mode) {
@ -222,6 +223,7 @@ void ReplicationFeature::prepareFollowerResponse(GeneralResponse* response,
break;
case ServerState::Mode::MAINTENANCE:
default: {
response->setResponseCode(rest::ResponseCode::SERVICE_UNAVAILABLE);
break;
}
}

View File

@ -418,6 +418,7 @@ rest::ResponseCode GeneralResponse::responseCode(int code) {
case TRI_ERROR_CLUSTER_SHARD_LEADER_RESIGNED:
case TRI_ERROR_CLUSTER_LEADERSHIP_CHALLENGE_ONGOING:
case TRI_ERROR_CLUSTER_NOT_LEADER:
case TRI_ERROR_SHUTTING_DOWN:
return ResponseCode::SERVICE_UNAVAILABLE;
case TRI_ERROR_CLUSTER_UNSUPPORTED: