1
0
Fork 0

VPP Header is now and Array instead of Object

This commit is contained in:
Jan Christoph Uhde 2016-08-24 15:51:44 +02:00
parent f9feb14a6e
commit ca433a92fd
2 changed files with 10 additions and 7 deletions

View File

@ -81,7 +81,7 @@ std::unordered_map<std::string, std::string> const& VppRequest::headers()
if (!_headers) {
using namespace std;
_headers = make_unique<unordered_map<string, string>>();
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<RequestType>(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<RequestType>(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<string> tmp;

View File

@ -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<int>(meta::underlyingValue(_responseCode))));