mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Include network response body in errors (#3987)
This commit is contained in:
parent
7337e93a27
commit
5655a7d718
|
@ -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
|
||||
|
||||
|
|
|
@ -218,8 +218,8 @@ void loadUncached(const std::shared_ptr<NetworkData> &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));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue