开发者

http.ServerRequest.prototype

开发者 https://www.devze.com 2023-01-14 12:38 出处:网络
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 callba

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

精彩评论

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

关注公众号