2015-11-24 07:47:29 +01:00
|
|
|
#include "FakeHttpClient.h"
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
using boost::optional;
|
|
|
|
using boost::none;
|
|
|
|
|
|
|
|
namespace cpputils {
|
|
|
|
FakeHttpClient::FakeHttpClient(): _sites() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void FakeHttpClient::addWebsite(const string &url, const string &content) {
|
|
|
|
_sites[url] = content;
|
|
|
|
}
|
|
|
|
|
2015-11-24 08:23:20 +01:00
|
|
|
optional<string> FakeHttpClient::get(const string &url, optional<long> timeoutMsec) {
|
|
|
|
UNUSED(timeoutMsec);
|
2015-11-24 07:47:29 +01:00
|
|
|
auto found = _sites.find(url);
|
|
|
|
if (found == _sites.end()) {
|
|
|
|
return none;
|
|
|
|
}
|
|
|
|
return found->second;
|
|
|
|
}
|
|
|
|
}
|