HttpClient icon indicating copy to clipboard operation
HttpClient copied to clipboard

undefined reference to `HttpClient::finishRequest()`

Open weberc2 opened this issue 2 years ago • 4 comments

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.

weberc2 avatar Aug 29 '23 13:08 weberc2

I'm seeing this as well.

joeyparrish avatar May 03 '24 17:05 joeyparrish

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();

joeyparrish avatar May 03 '24 17:05 joeyparrish

The last commit was 9 years ago, so I will assume that the author is no longer maintaining this library.

joeyparrish avatar May 03 '24 17:05 joeyparrish

https://github.com/arduino-libraries/ArduinoHttpClient is a fork of this, maintained as recently as 2 months ago.

joeyparrish avatar May 03 '24 18:05 joeyparrish