Skip to content

Cannot call more than once ESP8266HttpClient POST() #1902

Closed
@miky2k

Description

@miky2k

If i define ESP8266HttpClient websebd;
websend.begin("http://192.168.1.1/htpxml.php");
websend.addHeader("Content-Type", "text/xml");
websend.addHeader("Cookie:","XDEBUG_SESSION_START=session0");

then i call it two times:

websend.POST("some xml text");
websend.end();

websend.POST("another xml text");
websend.end();

POST /htpxml.php HTTP/1.1
Host: 192.168.1.1
User-Agent: ESP8266HTTPClient
Connection: close
Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
Content-Type: text/xml
Cookie:: XDEBUG_SESSION_START=session0
Content-Length: 744
Content-Length: 744

(Wireshark log)

if(payload && size > 0) {
addHeader("Content-Length", String(size));
}

don't know if it's the right mode to use object, but i would like to avoid
recreate the same object every time i have to send same file to same
url with same header!!

The code in sendrequest that add "definitely" content size to header.
if(payload && size > 0) {
addHeader("Content-Length", String(size));
}

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions