1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00
capybara-webkit/src/Header.cpp

20 lines
577 B
C++
Raw Normal View History

2011-06-08 05:36:45 -04:00
#include "Header.h"
#include "WebPage.h"
#include "WebPageManager.h"
2011-06-08 05:36:45 -04:00
#include "NetworkAccessManager.h"
Header::Header(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
2011-06-08 05:36:45 -04:00
}
void Header::start() {
QString key = arguments()[0];
QString value = arguments()[1];
NetworkAccessManager* networkAccessManager = manager()->networkAccessManager();
2011-06-08 05:36:45 -04:00
if (key.toLower().replace("-", "_") == "user_agent") {
page()->setUserAgent(value);
} else {
networkAccessManager->addHeader(key, value);
2011-06-08 05:36:45 -04:00
}
2013-02-11 18:31:41 -05:00
finish(true);
2011-06-08 05:36:45 -04:00
}