HttpClient
HttpClient copied to clipboard
undefined reference to `HttpClient::finishRequest()`
v2.2.0 - It looks like finishRequest() is declared in the header file but not implemented anywhere. Seems related to https://github.com/amcewen/HttpClient/issues/24, but that ticket contained no information for working around this issue.
I'm seeing this as well.
EDIT: corrected my initial statement, which involved a protected method. Fixed to use the public one.
I spent some time in the source code figuring this out. It looks like ~finishHeaders() is what we should use, or endRequest()~ endRequest() is the right method. The maintainer should really remove the bogus finishRequest() from the header.
If you need to send request headers, do something like this sequence:
// Tell the library you'll be sending some extra headers so it
// doesn't end the request headers automatically.
http_client.beginRequest();
// Send the GET request.
http_client.get(SERVER, PORT, PATH);
// Add headers.
http_client.sendHeader("foo", "bar");
// Finish the request.
http_client.endRequest();
The last commit was 9 years ago, so I will assume that the author is no longer maintaining this library.
https://github.com/arduino-libraries/ArduinoHttpClient is a fork of this, maintained as recently as 2 months ago.