File indexing completed on 2025-01-05 05:01:15

0001 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0002 // SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>
0003 
0004 #include "sentryconnection.h"
0005 
0006 SentryNetworkReply::SentryNetworkReply(QNetworkReply *reply, QObject *parent)
0007     : SentryReply(parent)
0008     , m_reply(reply)
0009 {
0010     connect(reply, &QNetworkReply::finished, this, &SentryReply::finished);
0011 }
0012 
0013 SentryNetworkReply::~SentryNetworkReply()
0014 {
0015     m_reply->deleteLater();
0016 }
0017 
0018 QByteArray SentryNetworkReply::readAll()
0019 {
0020     return m_reply->readAll();
0021 }
0022 
0023 QNetworkReply::NetworkError SentryNetworkReply::error()
0024 {
0025     return m_reply->error();
0026 }
0027 
0028 QString SentryNetworkReply::errorString()
0029 {
0030     return m_reply->errorString();
0031 }
0032 
0033 SentryNetworkConnection::SentryNetworkConnection(QObject *parent)
0034     : SentryConnection(parent)
0035 {
0036     m_manager.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
0037 }
0038 
0039 SentryReply *SentryNetworkConnection::get(const QNetworkRequest &request)
0040 {
0041     return new SentryNetworkReply(m_manager.get(request), this);
0042 }
0043 
0044 SentryReply *SentryNetworkConnection::post(const QNetworkRequest &request, const QByteArray &data)
0045 {
0046     return new SentryNetworkReply(m_manager.post(request, data), this);
0047 }
0048 
0049 #include "moc_sentryconnection.cpp"