diff --git a/CHANGELOG.md b/CHANGELOG.md index f76e6e24..311eb76c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ - Dev: Use Game Name returned by Get Streams instead of querying it from the Get Games API. (#3662) - Dev: Batch checking live status for all channels after startup. (#3757, #3762, #3767) - Dev: Move most command context into the command controller. (#3824) +- Dev: Error NetworkResults now include the body data. (#3987) ## 2.3.5 diff --git a/src/common/NetworkPrivate.cpp b/src/common/NetworkPrivate.cpp index c49fcff9..dcca585e 100644 --- a/src/common/NetworkPrivate.cpp +++ b/src/common/NetworkPrivate.cpp @@ -218,8 +218,8 @@ void loadUncached(const std::shared_ptr &data) QString(data->payload_)); } // TODO: Should this always be run on the GUI thread? - postToThread([data, code = status.toInt()] { - data->onError_(NetworkResult({}, code)); + postToThread([data, code = status.toInt(), reply] { + data->onError_(NetworkResult(reply->readAll(), code)); }); } diff --git a/tests/src/NetworkRequest.cpp b/tests/src/NetworkRequest.cpp index 96d62ca4..9c788ece 100644 --- a/tests/src/NetworkRequest.cpp +++ b/tests/src/NetworkRequest.cpp @@ -145,6 +145,11 @@ TEST(NetworkRequest, Error) .onError([code, &mut, &requestDone, &requestDoneCondition, url](NetworkResult result) { EXPECT_EQ(result.status(), code); + if (code == 402) + { + EXPECT_EQ(result.getData(), + QString("Fuck you, pay me!").toUtf8()); + } { std::unique_lock lck(mut);