I am using Node.js and module http-proxy
(link here) to proxy requests in my server.
What I want to achieve is performing certain action when an HTTP DELETE request is sent.
How can I do this? Module http-proxy
comes with a very poor documentation and objects like res
, req
and proxyRes
are not properly documented. From the doc it is possible to understand that object proxyRes
has a property called headers
and nothing more.
req.method is the property you want. It will be a string corresponding to the HTTP request method such as 'DELETE', 'GET', 'POST', etc. node-http-proxy does not document this because it is part of the node core http.IncomingMessage
standard API (docs linked above).