If you are getting a redirect then there should be a Location header with a new path or URL in it. Use that to create a new request. It is up to you which HTTP method you use for that request.
~Ryan On Fri, Jun 17, 2016, 7:28 AM Michael Chenetz <m...@chenetz.net> wrote: > I have a page that i am posting to and it redirects to another page. I > understand that most servers will redirect a POST to a GET. How do i catch > the redirect URL so that i can POST to it. Here is some example code below. > > var req = https.request({ > host: 'dashboard.meraki.com', > path: '/api/v0/networks/1234567/vlans/', > headers: { > 'x-cisco-meraki-api-key': '12345678' > }, > method: 'POST' > }, function (response) { > if (response.statusCode > 300 && response.statusCode < 400) { > > > } > console.log(response.headers); > response.on('data', (data)=> { > body += data; > }); > response.on('end', ()=> { > response.write(body) > }); > console.log(response); > }); > req.write(''); > req.end(); > > > Thanks... > > > Mike > > -- > Job board: http://jobs.nodejs.org/ > New group rules: > https://gist.github.com/othiym23/9886289#file-moderation-policy-md > Old group rules: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > --- > You received this message because you are subscribed to the Google Groups > "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to nodejs+unsubscr...@googlegroups.com. > To post to this group, send email to nodejs@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/nodejs/0969c55e-efbb-4ff5-bfd6-6459d4c556b6%40googlegroups.com > <https://groups.google.com/d/msgid/nodejs/0969c55e-efbb-4ff5-bfd6-6459d4c556b6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- ~Ryan -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/CAGjmZGyghgAUnT-yomgovWwfFXK1oQb%2BJ1TU1f9gkq8N30VHHw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.