mirror of https://gitee.com/bigwinds/arangodb
removed redundant declaration of HTTP status codes
This commit is contained in:
parent
1cac136bf6
commit
7543ad0283
|
@ -34,6 +34,7 @@
|
|||
#include "BasicsC/json.h"
|
||||
#include "BasicsC/tri-strings.h"
|
||||
#include "Rest/HttpRequest.h"
|
||||
#include "Rest/HttpResponse.h"
|
||||
#include "SimpleHttpClient/GeneralClientConnection.h"
|
||||
#include "SimpleHttpClient/SimpleHttpClient.h"
|
||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||
|
@ -93,7 +94,7 @@ V8ClientConnection::V8ClientConnection (Endpoint* endpoint,
|
|||
else {
|
||||
_lastHttpReturnCode = result->getHttpReturnCode();
|
||||
|
||||
if (result->getHttpReturnCode() == SimpleHttpResult::HTTP_STATUS_OK) {
|
||||
if (result->getHttpReturnCode() == HttpResponse::OK) {
|
||||
|
||||
// default value
|
||||
_version = "arango";
|
||||
|
@ -408,11 +409,11 @@ v8::Handle<v8::Value> V8ClientConnection::handleResult () {
|
|||
_lastErrorMessage = "Unknown error";
|
||||
}
|
||||
|
||||
_lastHttpReturnCode = SimpleHttpResult::HTTP_STATUS_SERVER_ERROR;
|
||||
_lastHttpReturnCode = HttpResponse::SERVER_ERROR;
|
||||
|
||||
v8::Handle<v8::Object> result = v8::Object::New();
|
||||
result->Set(v8::String::New("error"), v8::Boolean::New(true));
|
||||
result->Set(v8::String::New("code"), v8::Integer::New(SimpleHttpResult::HTTP_STATUS_SERVER_ERROR));
|
||||
result->Set(v8::String::New("code"), v8::Integer::New(HttpResponse::SERVER_ERROR));
|
||||
|
||||
int errorNumber = 0;
|
||||
|
||||
|
@ -520,10 +521,10 @@ v8::Handle<v8::Value> V8ClientConnection::requestDataRaw (HttpRequest::HttpReque
|
|||
_lastErrorMessage = "Unknown error";
|
||||
}
|
||||
|
||||
_lastHttpReturnCode = SimpleHttpResult::HTTP_STATUS_SERVER_ERROR;
|
||||
_lastHttpReturnCode = HttpResponse::SERVER_ERROR;
|
||||
|
||||
v8::Handle<v8::Object> result = v8::Object::New();
|
||||
result->Set(v8::String::New("code"), v8::Integer::New(SimpleHttpResult::HTTP_STATUS_SERVER_ERROR));
|
||||
result->Set(v8::String::New("code"), v8::Integer::New(HttpResponse::SERVER_ERROR));
|
||||
|
||||
int errorNumber = 0;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "Logger/Logger.h"
|
||||
#include "Rest/Endpoint.h"
|
||||
#include "Rest/InitialiseRest.h"
|
||||
#include "Rest/HttpResponse.h"
|
||||
#include "SimpleHttpClient/SimpleHttpClient.h"
|
||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||
#include "V8Client/V8ClientConnection.h"
|
||||
|
@ -296,7 +297,7 @@ int main (int argc, char* argv[]) {
|
|||
ArangoClient::DEFAULT_RETRIES,
|
||||
false);
|
||||
|
||||
if (! ClientConnection->isConnected() || ClientConnection->getLastHttpReturnCode() != SimpleHttpResult::HTTP_STATUS_OK) {
|
||||
if (! ClientConnection->isConnected() || ClientConnection->getLastHttpReturnCode() != HttpResponse::OK) {
|
||||
cerr << "Could not connect to endpoint " << BaseClient.endpointServer()->getSpecification() << endl;
|
||||
cerr << "Error message: '" << ClientConnection->getErrorMessage() << "'" << endl;
|
||||
TRI_EXIT_FUNCTION(EXIT_FAILURE,NULL);
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "BasicsC/tri-strings.h"
|
||||
#include "Rest/Endpoint.h"
|
||||
#include "Rest/InitialiseRest.h"
|
||||
#include "Rest/HttpResponse.h"
|
||||
#include "SimpleHttpClient/SimpleHttpClient.h"
|
||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||
#include "V8/JSLoader.h"
|
||||
|
@ -547,7 +548,7 @@ static v8::Handle<v8::Value> ClientConnection_ConstructorCallback (v8::Arguments
|
|||
|
||||
V8ClientConnection* connection = CreateConnection();
|
||||
|
||||
if (connection->isConnected() && connection->getLastHttpReturnCode() == SimpleHttpResult::HTTP_STATUS_OK) {
|
||||
if (connection->isConnected() && connection->getLastHttpReturnCode() == HttpResponse::OK) {
|
||||
cout << "Connected to ArangoDB '" << BaseClient.endpointServer()->getSpecification()
|
||||
<< "' Version " << connection->getVersion() << endl;
|
||||
}
|
||||
|
@ -1622,7 +1623,7 @@ int main (int argc, char* argv[]) {
|
|||
BaseClient.printWelcomeInfo();
|
||||
|
||||
if (useServer) {
|
||||
if (ClientConnection->isConnected() && ClientConnection->getLastHttpReturnCode() == SimpleHttpResult::HTTP_STATUS_OK) {
|
||||
if (ClientConnection->isConnected() && ClientConnection->getLastHttpReturnCode() == HttpResponse::OK) {
|
||||
cout << "Connected to ArangoDB '" << BaseClient.endpointServer()->getSpecification()
|
||||
<< "' version " << ClientConnection->getVersion() << endl;
|
||||
}
|
||||
|
|
|
@ -61,39 +61,8 @@ namespace triagens {
|
|||
UNKNOWN
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief http response codes
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum http_status_codes {
|
||||
HTTP_STATUS_OK = 200,
|
||||
HTTP_STATUS_CREATED = 201,
|
||||
HTTP_STATUS_ACCEPTED = 202,
|
||||
HTTP_STATUS_PARTIAL = 203,
|
||||
HTTP_STATUS_NO_RESPONSE = 204,
|
||||
|
||||
HTTP_STATUS_MOVED_PERMANENTLY = 301,
|
||||
HTTP_STATUS_FOUND = 302,
|
||||
HTTP_STATUS_SEE_OTHER = 303,
|
||||
HTTP_STATUS_NOT_MODIFIED = 304,
|
||||
HTTP_STATUS_TEMPORARY_REDIRECT = 307,
|
||||
|
||||
HTTP_STATUS_BAD = 400,
|
||||
HTTP_STATUS_UNAUTHORIZED = 401,
|
||||
HTTP_STATUS_PAYMENT = 402,
|
||||
HTTP_STATUS_FORBIDDEN = 403,
|
||||
HTTP_STATUS_NOT_FOUND = 404,
|
||||
HTTP_STATUS_METHOD_NOT_ALLOWED = 405,
|
||||
HTTP_STATUS_UNPROCESSABLE_ENTITY = 422,
|
||||
|
||||
HTTP_STATUS_SERVER_ERROR = 500,
|
||||
HTTP_STATUS_NOT_IMPLEMENTED = 501,
|
||||
HTTP_STATUS_BAD_GATEWAY = 502,
|
||||
HTTP_STATUS_SERVICE_UNAVAILABLE = 503 // Retry later
|
||||
};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue