KShare/logs/requestlogging.hpp
2017-08-21 16:17:20 +02:00

47 lines
846 B
C++

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