2

This is my program to catch M-SEARCH request.

router['m-search']('/', function(req, res, next) {
    res.send('Got a M-SEARCH request\n');
});

This code can response for such request.

M-SEARCH / HTTP/1.1

but, can not for such request

M-SEARCH * HTTP/1.1

So, What I've modified like this, but I could not find any changes on this situations.

router['m-search']('*', function(req, res, next) {
    res.send('Got a M-SEARCH request\n');
});

How can I catch real M-SEARCH request on Express?

yosh
  • 123
  • 7

1 Answers1

1

Express can't serve custom HTTP verbs, because nodejs under it has a hardcoded words in http parser module. https://github.com/joyent/node/blob/v0.10.29/deps/http_parser/http_parser.h#L87-119

Also you can check this answer: Serving non-standard HTTP method with ExpressJS

Community
  • 1
  • 1
vanadium23
  • 3,516
  • 15
  • 27
  • Thanks, (... but I cannot understand why Express team trying to implement UPnP method with such manner.) – yosh Apr 27 '15 at 12:14