From e94b6e10bf1abbd8cb2e14500ea34ca689ab9b21 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Mon, 20 Feb 2017 18:32:01 +0100 Subject: [PATCH] Node.js: add getResponsePrototype, getRequestPrototype again --- nodejs/http.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nodejs/http.h b/nodejs/http.h index 194f7bdf9..819bc7269 100644 --- a/nodejs/http.h +++ b/nodejs/http.h @@ -306,12 +306,22 @@ struct HttpServer { } } + static void getResponsePrototype(const FunctionCallbackInfo &args) { + args.GetReturnValue().Set(Local::New(args.GetIsolate(), resTemplate)->GetPrototype()); + } + + static void getRequestPrototype(const FunctionCallbackInfo &args) { + args.GetReturnValue().Set(Local::New(args.GetIsolate(), reqTemplate)->GetPrototype()); + } + static Local getHttpServer(Isolate *isolate) { Local httpServer = FunctionTemplate::New(isolate, HttpServer::createServer); httpServer->InstanceTemplate()->SetInternalFieldCount(1); httpServer->Set(String::NewFromUtf8(isolate, "createServer"), FunctionTemplate::New(isolate, HttpServer::createServer)); httpServer->Set(String::NewFromUtf8(isolate, "getExpressApp"), FunctionTemplate::New(isolate, HttpServer::getExpressApp)); + httpServer->Set(String::NewFromUtf8(isolate, "getResponsePrototype"), FunctionTemplate::New(isolate, HttpServer::getResponsePrototype)); + httpServer->Set(String::NewFromUtf8(isolate, "getRequestPrototype"), FunctionTemplate::New(isolate, HttpServer::getRequestPrototype)); httpServer->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "listen"), FunctionTemplate::New(isolate, HttpServer::listen)); httpServer->PrototypeTemplate()->Set(String::NewFromUtf8(isolate, "on"), FunctionTemplate::New(isolate, HttpServer::on));