mirror of https://gitee.com/bigwinds/arangodb
fix HTTP response code for HTTP 503 (#4610)
This commit is contained in:
parent
3434125c76
commit
aba64939e2
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue