-
Notifications
You must be signed in to change notification settings - Fork 170
Allow custom headers between startRequest & endRequest #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@toddtreece thanks for taking the time to submit this pull request! Could you please provide example sketches to show what was not working before these changes? |
@sandeepmistry sorry for the delay. i just was checking the status of this pull req, and noticed your message. i added a new example called GET Example client.startRequest("/", HTTP_METHOD_GET);
client.sendHeader("X-CUSTOM-HEADER", "custom_value");
client.endRequest(); test server output:
POST ExampleString postData = "name=Alice&age=12";
client.startRequest("/", HTTP_METHOD_POST);
client.sendHeader(HTTP_HEADER_CONTENT_TYPE, "application/x-www-form-urlencoded");
client.sendHeader(HTTP_HEADER_CONTENT_LENGTH, postData.length());
client.sendHeader("X-CUSTOM-HEADER", "custom_value");
client.endRequest();
client.write((const byte*)postData.c_str(), postData.length()); test server output:
|
we have some adafruit io examples that rely on this custom header change, but we don't want to publish tutorials pointing at our fork if we can avoid it. any chance someone could take a quick look at this change? |
@toddtreece thanks for the clarification. I've reviewed the additional example sketch you provided and noticed the call to My suggestion to move forward would be to leave the library side alone, and add a new example sketch for custom headers (like the modified one below). What do you think?
Server console logs:
|
Added the example posted in arduino-libraries#12 to close the PR. Tested and it works
Added the example posted in #12 to close the PR. Tested and it works
Closing this in favour of #20 for now. @toddtreece let us know if you'd still like more changes ... |
Changes
This change allows users to build more complex requests with custom headers when using
startRequest
andendRequest
. Calls to theget
,post
,put
, anddel
helpers will end the request as they did before.Tests
SimpleGet.ino:
SimplePost:
SimplePut:
SimpleDelete: