> So I'm dealing with a sitch where I have a device that can only generate a get request. Ideally, I'd like to redirect it to a post method. Using res.redirect, is there a way to do that?
No, and it's not a deficiency of express or node; rather, the HTTP specification doesn't really accommodate that usage.
http://stackoverflow.com/questions/46582/response-redirect-with-post-instead-of-get
The client itself must generate the POST request.
Also, you do understand what a redirect is, right? If I issue an HTTP GET request for http://nodejs.org/docs I receive the following response:
$ curl -I http://nodejs.org/docs
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 02 Feb 2012 21:15:02 GMT
Content-Type: text/html
Content-Length: 178
Location: http://nodejs.org/docs/
Connection: keep-alive
The server has issued a redirect: that is, it is telling my user agent "Please issue a new request for http://nodejs.org/docs/". I then have to issue that new request if I want to see the document.
Why do you think you need a POST request? Is this POST request to your node.js application, or to somebody else's server? If it's to your own app, rewrite your app to accept a GET request instead. If it's to someone else's server, write your own wrapper server which will accept a GET request, send a corresponding POST request to the foreign server, receive the result, and send it back to the client.
--
You received this message because you are subscribed to the Google Groups "Express" group.
To post to this group, send email to expre...@googlegroups.com.
To unsubscribe from this group, send email to express-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/express-js?hl=en.