mirror of
https://github.com/thoughtbot/capybara-webkit
synced 2023-03-27 23:22:28 -04:00

NetworkAccessManager was getting pretty complex, and adding something that modifies or intercepts requests is becoming a common change. This change introduces a chain of handlers which can modify a request or return a response of their own. To start with, this extracts the concerns of fixing missing content types, setting custom headers, and intercepting blacklisted requests.
15 lines
421 B
C++
15 lines
421 B
C++
#include "NetworkRequestFactory.h"
|
|
#include "NetworkAccessManager.h"
|
|
|
|
NetworkRequestFactory::NetworkRequestFactory(QObject *parent) :
|
|
RequestHandler(parent) {
|
|
}
|
|
|
|
QNetworkReply* NetworkRequestFactory::handleRequest(
|
|
NetworkAccessManager *manager,
|
|
QNetworkAccessManager::Operation operation,
|
|
QNetworkRequest &request,
|
|
QIODevice *outgoingData
|
|
) {
|
|
return manager->sendRequest(operation, request, outgoingData);
|
|
}
|