0

I am using Node.js and module http-proxy (link here) to proxy requests in my server.

Detecting DELETE requests

What I want to achieve is performing certain action when an HTTP DELETE request is sent.

Poor doc

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.

Community
  • 1
  • 1
Andry
  • 16,172
  • 27
  • 138
  • 246

1 Answers1

1

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).

Peter Lyons
  • 142,938
  • 30
  • 279
  • 274