static void JS_RawRequestBody(v8::FunctionCallbackInfo<v8::Value> const& args) {
  TRI_V8_TRY_CATCH_BEGIN(isolate);
  v8::HandleScope scope(isolate);
  auto context = TRI_IGETC;

  if (args.Length() != 1) {
    TRI_V8_THROW_EXCEPTION_USAGE("rawRequestBody(req)");
  }

  v8::Handle<v8::Value> current = args[0];
  if (current->IsObject()) {
    v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(current);
    v8::Handle<v8::Value> property =
      obj->Get(context, TRI_V8_ASCII_STRING(isolate, "internals")).FromMaybe(v8::Local<v8::Value>());
    if (property->IsExternal()) {
      v8::Handle<v8::External> e = v8::Handle<v8::External>::Cast(property);

      GeneralRequest* request = static_cast<GeneralRequest*>(e->Value());

      switch (request->transportType()) {
        case Endpoint::TransportType::HTTP: {
          auto httpRequest = static_cast<arangodb::HttpRequest*>(e->Value());
          if (httpRequest != nullptr) {
            V8Buffer* buffer;
            if (rest::ContentType::VPACK == request->contentType()) {
              VPackSlice slice = request->payload();
              std::string bodyStr = slice.toJson();
              buffer = V8Buffer::New(isolate, bodyStr.c_str(), bodyStr.size());
            } else {
              std::string_view raw = httpRequest->rawPayload();
              buffer = V8Buffer::New(isolate, raw.data(), raw.size());
            }

            v8::Local<v8::Object> bufferObject =
              v8::Local<v8::Object>::New(isolate, buffer->_handle);
            TRI_V8_RETURN(bufferObject);
          }
        } break;

        case Endpoint::TransportType::VST: {
          if (request != nullptr) {
            std::string_view raw = request->rawPayload();
            V8Buffer* buffer = V8Buffer::New(isolate, raw.data(), raw.size());
            v8::Local<v8::Object> bufferObject =
              v8::Local<v8::Object>::New(isolate, buffer->_handle);
            TRI_V8_RETURN(bufferObject);
          }
        } break;
      }
    }
  }

  // VPackSlice slice(data);
  // v8::Handle<v8::Value> result = TRI_VPackToV8(isolate, slice);
  TRI_V8_RETURN_UNDEFINED();
  TRI_V8_TRY_CATCH_END
}
static void JS_RawRequestBody(v8::FunctionCallbackInfo<v8::Value> const& args) {
  TRI_V8_TRY_CATCH_BEGIN(isolate);
  v8::HandleScope scope(isolate);
  auto context = TRI_IGETC;

  if (args.Length() != 1) {
    TRI_V8_THROW_EXCEPTION_USAGE("rawRequestBody(req)");
  }

  v8::Handle<v8::Value> current = args[0];
  if (current->IsObject()) {
    v8::Handle<v8::Object> obj = v8::Handle<v8::Object>::Cast(current);
    v8::Handle<v8::Value> property =
      obj->Get(context, TRI_V8_ASCII_STRING(isolate, "internals")).FromMaybe(v8::Local<v8::Value>());
    if (property->IsExternal()) {
      v8::Handle<v8::External> e = v8::Handle<v8::External>::Cast(property);

      GeneralRequest* request = static_cast<GeneralRequest*>(e->Value());

      switch (request->transportType()) {
        case Endpoint::TransportType::HTTP: {
          auto httpRequest = static_cast<arangodb::HttpRequest*>(e->Value());
          if (httpRequest != nullptr) {
            V8Buffer* buffer;
            if (rest::ContentType::VPACK == request->contentType()) {
              VPackSlice slice = request->payload();
              std::string bodyStr = slice.toJson();
              buffer = V8Buffer::New(isolate, bodyStr.c_str(), bodyStr.size());
            } else {
              std::string_view raw = httpRequest->rawPayload();
              buffer = V8Buffer::New(isolate, raw.data(), raw.size());
            }

            v8::Local<v8::Object> bufferObject =
              v8::Local<v8::Object>::New(isolate, buffer->_handle);
            TRI_V8_RETURN(bufferObject);
          }
        } break;

        case Endpoint::TransportType::VST: {
          if (request != nullptr) {
            std::string_view raw = request->rawPayload();
            V8Buffer* buffer = V8Buffer::New(isolate, raw.data(), raw.size());
            v8::Local<v8::Object> bufferObject =
              v8::Local<v8::Object>::New(isolate, buffer->_handle);
            TRI_V8_RETURN(bufferObject);
          }
        } break;
      }
    }
  }

   
   
  TRI_V8_RETURN_UNDEFINED();
  TRI_V8_TRY_CATCH_END
}