You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
846 B

#ifndef REQUESTLOGGING_HPP
#define REQUESTLOGGING_HPP
#include <QByteArray>
#include <QNetworkReply>
#include <settings.hpp>
4 years ago
namespace requestlogging {
struct RequestContext {
QByteArray response;
QNetworkReply *reply;
};
class LoggedRequest {
friend QList<LoggedRequest> getRequests();
public:
QString getUrl() {
return url;
}
QString getType() {
return type;
}
4 years ago
QString getTime() {
return time;
}
int getResponseCode() {
return responseCode;
}
QByteArray getResponse() {
4 years ago
return QFile(settings::dir().absoluteFilePath("responses/" + time)).readAll();
}
private:
QString url;
QString type;
4 years ago
QString time;
int responseCode;
};
QList<LoggedRequest> getRequests();
4 years ago
void addEntry(RequestContext context);
}
#endif // REQUESTLOGGING_HPP