Closed ryanballa closed 2 years ago
Which board are you using?
Which board are you using?
I'm using the ESP8266 NodeMCU CP2102 ESP-12E
I'm really sorry for not responding earlier. I just noticed an issue so small in your code I'm embarrassed I could have helped you earlier, I apologize!
You are storing headers in a separate Headers object:
RequestOptions options;
Headers headers;
headers.contentType = "application/json";
headers.connection = "keep-alive";
headers.authkey = "foxtrot%LovesAPIs2022!";
You do not need that. options.headers
is where you should add your headers:
RequestOptions options;
options.headers.contentType = "application/json";
options.headers.connection = "keep-alive";
options.headers.authkey = "foxtrot%LovesAPIs2022!";
OR you could have done is add this line before fetch
ing in your original code:
options.headers = headers;
This would send your headers with the request. Your original code is saving your headers in your headers object but not adding it to the request options.
I hope this solves your issue. And can you suggest any change in documentation that will clarify things for other people so they don't repeat this mistake?
Hi, I cannot seem to get my code working with HTTPS. It will just print out dots instead of any response. Any help would be appreciated.