Thanks... That's what i figured but i was hoping that there was a better way. ;-)
On Friday, June 17, 2016 at 4:30:36 PM UTC-4, Ryan Graham wrote: > > 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 <[email protected] > <javascript:>> 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 [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/618d782a-d577-40b3-a6eb-2b76012557bd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
