6 class HttpReply : public QObject {
10 HttpReply(QObject *parent = nullptr);
11 virtual QUrl url() const = 0;
12 virtual int statusCode() const = 0;
13 int isSuccessful() const;
14 virtual QString reasonPhrase() const;
15 virtual const QList<QNetworkReply::RawHeaderPair> headers() const;
16 virtual QByteArray header(const QByteArray &headerName) const;
17 virtual QByteArray body() const = 0;
19 template <typename Functor> HttpReply &onData(Functor lambda) {
20 connect(this, &HttpReply::data, this, lambda);
23 template <typename Functor> HttpReply &onError(Functor lambda) {
24 connect(this, &HttpReply::error, this, lambda);
27 template <typename Functor> HttpReply &onFinished(Functor lambda) {
28 connect(this, &HttpReply::finished, this, lambda);
33 void data(const QByteArray &bytes);
34 void error(const QString &message);
35 void finished(const HttpReply &reply);