1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

LibHTTP: Always send Content-Length header in POST requests

Required by Google services, Content-Length should always been sent,
even when there is no body.
This commit is contained in:
Luke Wilde 2022-11-05 04:02:41 +00:00 committed by Andreas Kling
parent 1473bc9169
commit b8b263d9c3

View file

@ -67,7 +67,7 @@ ByteBuffer HttpRequest::to_raw_request() const
builder.append(header.value);
builder.append("\r\n"sv);
}
if (!m_body.is_empty()) {
if (!m_body.is_empty() || method() == Method::POST) {
builder.appendff("Content-Length: {}\r\n\r\n", m_body.size());
builder.append((char const*)m_body.data(), m_body.size());
}