diff --git a/lib/Rest/VppRequest.cpp b/lib/Rest/VppRequest.cpp index 9e1db8c36a..6722374d68 100644 --- a/lib/Rest/VppRequest.cpp +++ b/lib/Rest/VppRequest.cpp @@ -81,7 +81,7 @@ std::unordered_map const& VppRequest::headers() if (!_headers) { using namespace std; _headers = make_unique>(); - VPackSlice meta = _message.header().get("meta"); + VPackSlice meta = _message.header().at(6); // get meta for (auto const& it : VPackObjectIterator(meta)) { // must lower-case the header key _headers->emplace(StringUtils::tolower(it.key.copyString()), @@ -106,11 +106,14 @@ void VppRequest::parseHeaderInformation() { using namespace std; auto vHeader = _message.header(); try { - _databaseName = vHeader.get("database").copyString(); - _requestPath = vHeader.get("request").copyString(); - _type = meta::toEnum(vHeader.get("requestType").getInt()); + TRI_ASSERT(vHeader.isArray()); + // vHeader.at(0).getInt() //version + // vHeader.at(1).getInt() //type + _databaseName = vHeader.at(2).copyString(); // database + _type = meta::toEnum(vHeader.at(3).getInt()); // request type + _requestPath = vHeader.at(4).copyString(); // request (path) + VPackSlice params = vHeader.at(5); // parameter - VPackSlice params = vHeader.get("parameter"); for (auto const& it : VPackObjectIterator(params)) { if (it.value.isArray()) { vector tmp; diff --git a/lib/Rest/VppResponse.cpp b/lib/Rest/VppResponse.cpp index fa90e6e0ad..df4872896b 100644 --- a/lib/Rest/VppResponse.cpp +++ b/lib/Rest/VppResponse.cpp @@ -70,9 +70,9 @@ VPackMessageNoOwnBuffer VppResponse::prepareForNetwork() { // initalize builder with vpackbuffer. then we do not need to // steal the header and can avoid the shared pointer VPackBuilder builder; - builder.openObject(); + builder.openArray(); builder.add("version", VPackValue(int(1))); - builder.add("type", VPackValue(int(1))); // 2 == response + builder.add("type", VPackValue(int(2))); // 2 == response builder.add( "responseCode", VPackValue(static_cast(meta::underlyingValue(_responseCode))));