1
0
Fork 0

this fixes the "undefined" HTTP status codes in the generated documentation (#6322)

This commit is contained in:
Jan 2018-08-31 20:15:17 +02:00 committed by GitHub
parent 1a4ccf9de8
commit 3c638849bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -39,7 +39,11 @@ using namespace arangodb::fuerte::v1;
using namespace arangodb::fuerte::v1::http;
int on_message_began(http_parser* parser) { return 0; }
int on_status(http_parser* parser, const char* at, size_t len) { return 0; }
int on_status(http_parser* parser, const char* at, size_t len) {
RequestItem* data = static_cast<RequestItem*>(parser->data);
data->_response->header.meta.emplace(std::string("http/") + std::to_string(parser->http_major) + '.' + std::to_string(parser->http_minor), std::string(at, len));
return 0;
}
int on_header_field(http_parser* parser, const char* at, size_t len) {
RequestItem* data = static_cast<RequestItem*>(parser->data);
if (data->last_header_was_a_value) {

View File

@ -73,7 +73,6 @@ V8ClientConnection::~V8ClientConnection() {
}
void V8ClientConnection::createConnection() {
auto newConnection = _builder.connect(_loop);
fuerte::StringMap params{{"details","true"}};
auto req = fuerte::createRequest(fuerte::RestVerb::Get, "/_api/version", params);
@ -1365,9 +1364,9 @@ v8::Local<v8::Value> V8ClientConnection::requestData(
_lastErrorMessage = "";
_lastHttpReturnCode = 0;
if (!_connection) {
_lastErrorMessage = "not connected";
_lastHttpReturnCode = 503;
return v8::Null(isolate);
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
"not connected");
return v8::Undefined(isolate);
}
auto req = std::make_unique<fuerte::Request>();
@ -1431,6 +1430,11 @@ v8::Local<v8::Value> V8ClientConnection::requestDataRaw(
_lastErrorMessage = "";
_lastHttpReturnCode = 0;
if (!_connection) {
TRI_V8_SET_EXCEPTION_MESSAGE(TRI_SIMPLE_CLIENT_COULD_NOT_CONNECT,
"not connected");
return v8::Undefined(isolate);
}
auto req = std::make_unique<fuerte::Request>();
req->header.restVerb = method;