开发者

http.ServerRequest.prototype

I want to add my own method to htt开发者_开发知识库p.ServerRequest object. But http.ServerRequest is null. I tried requset.prototype.testtest = function() { console.log('aaaaa'); }; in server callback. It answers 'TypeError: Cannot set property 'testtest' of undefined'. How to add method to ServerRequest objects?


You can use http.IncomingMessage.prototype.testtest = function() { ... }

ServerRequest is a IncomingMessage object

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜