Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (20 sloc) 932 Bytes
#include "NetworkAccessManager.h"
#include "WebPage.h"
#include <iostream>
NetworkAccessManager::NetworkAccessManager(QObject *parent):QNetworkAccessManager(parent) {
}
QNetworkReply* NetworkAccessManager::createRequest(QNetworkAccessManager::Operation operation, const QNetworkRequest &request, QIODevice * outgoingData = 0) {
QNetworkRequest new_request(request);
if (operation != QNetworkAccessManager::PostOperation && operation != QNetworkAccessManager::PutOperation) {
new_request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant());
}
QHashIterator<QString, QString> item(m_headers);
while (item.hasNext()) {
item.next();
new_request.setRawHeader(item.key().toAscii(), item.value().toAscii());
}
return QNetworkAccessManager::createRequest(operation, new_request, outgoingData);
};
void NetworkAccessManager::addHeader(QString key, QString value) {
m_headers.insert(key, value);
};
Something went wrong with that request. Please try again.