Closed solidogen closed 2 years ago
What device are you using? Is it possible it doesn't support HTTPS so is trying an HTTP request, and so is getting the redirect?
Hmm that makes sense.
I'm using NodeMCU v3
Yes, that's do it... NodeMCU is ESP8266 which I'm pretty sure doesn't do HTTPS with Espruino - I think we found there wasn't enough RAM for Espruino and HTTPS
Thanks, I resolved this by hosting my server on Heroku, which allows http connections, unlike Netlify and Vercel :+1: Now device can successfully fetch data from https://tt-robot-web.herokuapp.com/api/diode
Turned out next.js had nothing to do with the issue itself.
I'm trying to connect to REST api written using next.js api routes.
I'm getting permanent redirection response to the same page, but browser handles this gracefully and fetches the data.
In browser dev tools it doesn't look like there are any redirects at all.
How can I replicate this behavior in espruino code? Calling the same page always gets me 301. I tried using
Connection: keep-alive
but it doesn't do anything I guess.Simplest reproducer: