Get http reply text on error in wasm's network reply

A failed response also carries response text. Read it and assign it
to the response.

Fixes: QTBUG-112474
Change-Id: I5565e3809e2c9c95bf8e0744b3ab15a62b07106c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
This commit is contained in:
Mikolaj Boc 2023-03-31 17:02:27 +02:00
parent f04974751d
commit ce5fb1e709

View File

@ -538,6 +538,8 @@ void QNetworkReplyWasmImplPrivate::downloadFailed(emscripten_fetch_t *fetch)
reasonStr = QStringLiteral("Operation canceled");
else
reasonStr = QString::fromUtf8(fetch->statusText);
QByteArray buffer(fetch->data, fetch->numBytes);
reply->dataReceived(buffer, buffer.size());
QByteArray statusText(fetch->statusText);
reply->setStatusCode(fetch->status, statusText);
reply->emitReplyError(reply->statusCodeFromHttp(fetch->status, reply->request.url()), reasonStr);