Commit 847d6068 authored by Paweł Wegner's avatar Paweł Wegner

Request: create stringstream output by default.

parent 0b7cbdb4
...@@ -41,7 +41,6 @@ void move(typename Request<T>::Pointer r, IHttp* http, std::string metadata_url, ...@@ -41,7 +41,6 @@ void move(typename Request<T>::Pointer r, IHttp* http, std::string metadata_url,
std::function<void(EitherError<void>)> complete) { std::function<void(EitherError<void>)> complete) {
if (lst->empty()) return complete(nullptr); if (lst->empty()) return complete(nullptr);
auto parent = lst->back(); auto parent = lst->back();
auto output = std::make_shared<std::stringstream>();
lst->pop_back(); lst->pop_back();
r->sendRequest( r->sendRequest(
[=](util::Output stream) { [=](util::Output stream) {
...@@ -54,13 +53,12 @@ void move(typename Request<T>::Pointer r, IHttp* http, std::string metadata_url, ...@@ -54,13 +53,12 @@ void move(typename Request<T>::Pointer r, IHttp* http, std::string metadata_url,
*stream << json; *stream << json;
return request; return request;
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) if (e.left())
complete(e.left()); complete(e.left());
else else
move<T>(r, http, metadata_url, lst, source, destination, complete); move<T>(r, http, metadata_url, lst, source, destination, complete);
}, });
output);
} }
} // namespace } // namespace
......
...@@ -102,7 +102,6 @@ void rename(typename Request<T>::Pointer r, IHttp* http, std::string region, ...@@ -102,7 +102,6 @@ void rename(typename Request<T>::Pointer r, IHttp* http, std::string region,
ItemId dest_id, ItemId source_id, ItemId dest_id, ItemId source_id,
std::function<void(EitherError<void>)> complete) { std::function<void(EitherError<void>)> complete) {
auto finalize = [=]() { auto finalize = [=]() {
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output) { [=](util::Output) {
return http->create("https://" + source_id.first + ".s3." + region + return http->create("https://" + source_id.first + ".s3." + region +
...@@ -110,17 +109,15 @@ void rename(typename Request<T>::Pointer r, IHttp* http, std::string region, ...@@ -110,17 +109,15 @@ void rename(typename Request<T>::Pointer r, IHttp* http, std::string region,
escapePath(source_id.second), escapePath(source_id.second),
"DELETE"); "DELETE");
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) if (e.left())
complete(e.left()); complete(e.left());
else else
complete(nullptr); complete(nullptr);
}, });
output);
}; };
auto rename_one = [=](std::function<void(EitherError<void>)> complete, auto rename_one = [=](std::function<void(EitherError<void>)> complete,
bool directory = true) { bool directory = true) {
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output) { [=](util::Output) {
auto request = http->create( auto request = http->create(
...@@ -133,13 +130,12 @@ void rename(typename Request<T>::Pointer r, IHttp* http, std::string region, ...@@ -133,13 +130,12 @@ void rename(typename Request<T>::Pointer r, IHttp* http, std::string region,
escapePath("/" + source_id.first + "/" + source_id.second)); escapePath("/" + source_id.first + "/" + source_id.second));
return request; return request;
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) if (e.left())
complete(e.left()); complete(e.left());
else else
finalize(); finalize();
}, });
output);
}; };
if (source_id.second.empty() || source_id.second.back() == '/') { if (source_id.second.empty() || source_id.second.back() == '/') {
auto item = std::make_shared<Item>( auto item = std::make_shared<Item>(
...@@ -290,7 +286,6 @@ ICloudProvider::DeleteItemRequest::Pointer AmazonS3::deleteItemAsync( ...@@ -290,7 +286,6 @@ ICloudProvider::DeleteItemRequest::Pointer AmazonS3::deleteItemAsync(
r->set( r->set(
[=](Request<EitherError<void>>::Pointer r) { [=](Request<EitherError<void>>::Pointer r) {
auto release = [=] { auto release = [=] {
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output) { [=](util::Output) {
auto data = extract(item->id()); auto data = extract(item->id());
...@@ -299,10 +294,9 @@ ICloudProvider::DeleteItemRequest::Pointer AmazonS3::deleteItemAsync( ...@@ -299,10 +294,9 @@ ICloudProvider::DeleteItemRequest::Pointer AmazonS3::deleteItemAsync(
escapePath(data.second), escapePath(data.second),
"DELETE"); "DELETE");
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
r->done(e.left() ? e.left() : nullptr); r->done(e.left() ? e.left() : nullptr);
}, });
output);
}; };
if (item->type() == IItem::FileType::Directory) { if (item->type() == IItem::FileType::Directory) {
r->subrequest(r->provider()->listDirectoryAsync( r->subrequest(r->provider()->listDirectoryAsync(
...@@ -344,42 +338,35 @@ ICloudProvider::GetItemDataRequest::Pointer AmazonS3::getItemDataAsync( ...@@ -344,42 +338,35 @@ ICloudProvider::GetItemDataRequest::Pointer AmazonS3::getItemDataAsync(
request->setParameter("delimiter", "/"); request->setParameter("delimiter", "/");
return request; return request;
}; };
auto output = std::make_shared<std::stringstream>(); r->sendRequest(factory, [=](EitherError<Response> e) {
r->sendRequest( if (e.left()) return r->done(e.left());
factory, std::stringstream sstream;
[=](EitherError<util::Output> e) { sstream << e.right()->output().rdbuf();
if (e.left()) return r->done(e.left()); tinyxml2::XMLDocument document;
std::stringstream sstream; if (document.Parse(sstream.str().c_str(), sstream.str().size()) !=
sstream << output->rdbuf(); tinyxml2::XML_SUCCESS)
tinyxml2::XMLDocument document; return r->done(Error{IHttpRequest::Failure, "invalid xml"});
if (document.Parse(sstream.str().c_str(), sstream.str().size()) != auto node = document.RootElement();
tinyxml2::XML_SUCCESS) auto size = IItem::UnknownSize;
return r->done(Error{IHttpRequest::Failure, "invalid xml"}); auto timestamp = IItem::UnknownTimeStamp;
auto node = document.RootElement(); if (auto contents_element = node->FirstChildElement("Contents")) {
auto size = IItem::UnknownSize; if (auto size_element = contents_element->FirstChildElement("Size"))
auto timestamp = IItem::UnknownTimeStamp; if (auto text = size_element->GetText()) size = std::atoll(text);
if (auto contents_element = node->FirstChildElement("Contents")) { if (auto time_element =
if (auto size_element = contents_element->FirstChildElement("LastModified"))
contents_element->FirstChildElement("Size")) if (auto text = time_element->GetText())
if (auto text = size_element->GetText()) timestamp = util::parse_time(text);
size = std::atoll(text); }
if (auto time_element = auto type = data.second.back() == '/' ? IItem::FileType::Directory
contents_element->FirstChildElement("LastModified")) : IItem::FileType::Unknown;
if (auto text = time_element->GetText()) auto item = std::make_shared<Item>(
timestamp = util::parse_time(text); getFilename(data.second), id,
} type == IItem::FileType::Directory ? IItem::UnknownSize : size,
auto type = data.second.back() == '/' ? IItem::FileType::Directory timestamp, type);
: IItem::FileType::Unknown; if (item->type() != IItem::FileType::Directory)
auto item = std::make_shared<Item>( item->set_url(getUrl(*item));
getFilename(data.second), id, r->done(EitherError<IItem>(item));
type == IItem::FileType::Directory ? IItem::UnknownSize });
: size,
timestamp, type);
if (item->type() != IItem::FileType::Directory)
item->set_url(getUrl(*item));
r->done(EitherError<IItem>(item));
},
output);
}, },
callback); callback);
return r->run(); return r->run();
......
...@@ -68,35 +68,33 @@ ICloudProvider::GetItemDataRequest::Pointer Box::getItemDataAsync( ...@@ -68,35 +68,33 @@ ICloudProvider::GetItemDataRequest::Pointer Box::getItemDataAsync(
auto r = std::make_shared<Request<EitherError<IItem>>>(shared_from_this()); auto r = std::make_shared<Request<EitherError<IItem>>>(shared_from_this());
r->set( r->set(
[=](Request<EitherError<IItem>>::Pointer r) { [=](Request<EitherError<IItem>>::Pointer r) {
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[this, id](util::Output) { [this, id](util::Output) {
return http()->create(endpoint() + "/2.0/files/" + id, "GET"); return http()->create(endpoint() + "/2.0/files/" + id, "GET");
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) { if (e.left()) {
r->sendRequest( r->sendRequest(
[this, id](util::Output) { [this, id](util::Output) {
return http()->create(endpoint() + "/2.0/folders/" + id, return http()->create(endpoint() + "/2.0/folders/" + id,
"GET"); "GET");
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) if (e.left())
r->done(e.left()); r->done(e.left());
else { else {
try { try {
Json::Value response; Json::Value response;
*output >> response; e.right()->output() >> response;
r->done(toItem(response)); r->done(toItem(response));
} catch (std::exception) { } catch (std::exception) {
r->done(Error{IHttpRequest::Failure, output->str()}); r->done(Error{IHttpRequest::Failure,
e.right()->output().str()});
} }
} }
}, });
output);
} }
}, });
output);
}, },
callback); callback);
return r->run(); return r->run();
......
...@@ -39,7 +39,6 @@ namespace cloudstorage { ...@@ -39,7 +39,6 @@ namespace cloudstorage {
namespace { namespace {
void upload(Request<EitherError<IItem>>::Pointer r, int sent, void upload(Request<EitherError<IItem>>::Pointer r, int sent,
IUploadFileCallback* callback, Json::Value response) { IUploadFileCallback* callback, Json::Value response) {
auto output = std::make_shared<std::stringstream>();
int size = callback->size(); int size = callback->size();
auto length = std::make_shared<int>(0); auto length = std::make_shared<int>(0);
if (sent >= size) if (sent >= size)
...@@ -58,17 +57,17 @@ void upload(Request<EitherError<IItem>>::Pointer r, int sent, ...@@ -58,17 +57,17 @@ void upload(Request<EitherError<IItem>>::Pointer r, int sent,
stream->write(buffer.data(), *length); stream->write(buffer.data(), *length);
return request; return request;
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) return r->done(e.left()); if (e.left()) return r->done(e.left());
try { try {
Json::Value json; Json::Value json;
*output >> json; e.right()->output() >> json;
upload(r, sent + *length, callback, json); upload(r, sent + *length, callback, json);
} catch (std::exception) { } catch (std::exception) {
r->done(Error{IHttpRequest::Failure, output->str()}); r->done(Error{IHttpRequest::Failure, e.right()->output().str()});
} }
}, },
output, nullptr, nullptr, nullptr,
[=](uint32_t, uint32_t now) { callback->progress(size, sent + now); }); [=](uint32_t, uint32_t now) { callback->progress(size, sent + now); });
} }
} // namespace } // namespace
...@@ -86,7 +85,6 @@ ICloudProvider::UploadFileRequest::Pointer OneDrive::uploadFileAsync( ...@@ -86,7 +85,6 @@ ICloudProvider::UploadFileRequest::Pointer OneDrive::uploadFileAsync(
auto callback = cb.get(); auto callback = cb.get();
r->set( r->set(
[=](Request<EitherError<IItem>>::Pointer r) { [=](Request<EitherError<IItem>>::Pointer r) {
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output) { [=](util::Output) {
return http()->create( return http()->create(
...@@ -94,17 +92,17 @@ ICloudProvider::UploadFileRequest::Pointer OneDrive::uploadFileAsync( ...@@ -94,17 +92,17 @@ ICloudProvider::UploadFileRequest::Pointer OneDrive::uploadFileAsync(
util::Url::escape(filename) + ":/upload.createSession", util::Url::escape(filename) + ":/upload.createSession",
"POST"); "POST");
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) return r->done(e.left()); if (e.left()) return r->done(e.left());
try { try {
Json::Value response; Json::Value response;
*output >> response; e.right()->output() >> response;
upload(r, 0, callback, response); upload(r, 0, callback, response);
} catch (std::exception) { } catch (std::exception) {
r->done(Error{IHttpRequest::Failure, output->str()}); r->done(
Error{IHttpRequest::Failure, e.right()->output().str()});
} }
}, });
output);
}, },
[=](EitherError<IItem> e) { cb->done(e); }); [=](EitherError<IItem> e) { cb->done(e); });
return r->run(); return r->run();
......
...@@ -93,7 +93,6 @@ ICloudProvider::UploadFileRequest::Pointer YandexDisk::uploadFileAsync( ...@@ -93,7 +93,6 @@ ICloudProvider::UploadFileRequest::Pointer YandexDisk::uploadFileAsync(
path += filename; path += filename;
auto upload_url = [=](Request<EitherError<IItem>>::Pointer r, auto upload_url = [=](Request<EitherError<IItem>>::Pointer r,
std::function<void(EitherError<std::string>)> f) { std::function<void(EitherError<std::string>)> f) {
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output) { [=](util::Output) {
auto request = auto request =
...@@ -101,24 +100,22 @@ ICloudProvider::UploadFileRequest::Pointer YandexDisk::uploadFileAsync( ...@@ -101,24 +100,22 @@ ICloudProvider::UploadFileRequest::Pointer YandexDisk::uploadFileAsync(
request->setParameter("path", path); request->setParameter("path", path);
return request; return request;
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) f(e.left()); if (e.left()) f(e.left());
try { try {
Json::Value response; Json::Value response;
*output >> response; e.right()->output() >> response;
f(response["href"].asString()); f(response["href"].asString());
} catch (std::exception) { } catch (std::exception) {
f(Error{IHttpRequest::Failure, output->str()}); f(Error{IHttpRequest::Failure, e.right()->output().str()});
} }
}, });
output);
}; };
auto upload = [=](Request<EitherError<IItem>>::Pointer r, std::string url, auto upload = [=](Request<EitherError<IItem>>::Pointer r, std::string url,
std::function<void(EitherError<IItem>)> f) { std::function<void(EitherError<IItem>)> f) {
auto wrapper = std::make_shared<UploadStreamWrapper>( auto wrapper = std::make_shared<UploadStreamWrapper>(
std::bind(&IUploadFileCallback::putData, callback.get(), _1, _2), std::bind(&IUploadFileCallback::putData, callback.get(), _1, _2),
callback->size()); callback->size());
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output input) { [=](util::Output input) {
auto request = http()->create(url, "PUT"); auto request = http()->create(url, "PUT");
...@@ -127,14 +124,14 @@ ICloudProvider::UploadFileRequest::Pointer YandexDisk::uploadFileAsync( ...@@ -127,14 +124,14 @@ ICloudProvider::UploadFileRequest::Pointer YandexDisk::uploadFileAsync(
input->rdbuf(wrapper.get()); input->rdbuf(wrapper.get());
return request; return request;
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) return f(e.left()); if (e.left()) return f(e.left());
IItem::Pointer item = util::make_unique<Item>( IItem::Pointer item = util::make_unique<Item>(
filename, path, wrapper->size_, std::chrono::system_clock::now(), filename, path, wrapper->size_, std::chrono::system_clock::now(),
IItem::FileType::Unknown); IItem::FileType::Unknown);
f(item); f(item);
}, },
output, nullptr, nullptr, nullptr,
std::bind(&IUploadFileCallback::progress, callback.get(), _1, _2)); std::bind(&IUploadFileCallback::progress, callback.get(), _1, _2));
}; };
r->set( r->set(
......
...@@ -140,19 +140,19 @@ ICloudProvider::GetItemDataRequest::Pointer YouTube::getItemDataAsync( ...@@ -140,19 +140,19 @@ ICloudProvider::GetItemDataRequest::Pointer YouTube::getItemDataAsync(
IItem::UnknownTimeStamp, IItem::FileType::Directory); IItem::UnknownTimeStamp, IItem::FileType::Directory);
return r->done(i); return r->done(i);
} }
auto response_stream = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output input) { return getItemDataRequest(id, *input); }, [=](util::Output input) { return getItemDataRequest(id, *input); },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) return r->done(e.left()); if (e.left()) return r->done(e.left());
auto id_data = from_string(id); auto id_data = from_string(id);
try { try {
r->done(getItemDataResponse(*response_stream, id_data.audio)); r->done(
getItemDataResponse(e.right()->output(), id_data.audio));
} catch (std::exception) { } catch (std::exception) {
r->done(Error{IHttpRequest::Failure, response_stream->str()}); r->done(
Error{IHttpRequest::Failure, e.right()->output().str()});
} }
}, });
response_stream);
}, },
callback); callback);
return r->run(); return r->run();
......
...@@ -39,21 +39,20 @@ CreateDirectoryRequest::CreateDirectoryRequest(std::shared_ptr<CloudProvider> p, ...@@ -39,21 +39,20 @@ CreateDirectoryRequest::CreateDirectoryRequest(std::shared_ptr<CloudProvider> p,
callback(e); callback(e);
return done(e); return done(e);
} }
auto output = std::make_shared<std::stringstream>();
sendRequest( sendRequest(
[=](util::Output stream) { [=](util::Output stream) {
return provider()->createDirectoryRequest(*parent, name, *stream); return provider()->createDirectoryRequest(*parent, name, *stream);
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) return request->done(e.left()); if (e.left()) return request->done(e.left());
try { try {
request->done(provider()->createDirectoryResponse(*parent, name, request->done(provider()->createDirectoryResponse(
*output)); *parent, name, e.right()->output()));
} catch (std::exception) { } catch (std::exception) {
request->done(Error{IHttpRequest::Failure, output->str()}); request->done(
Error{IHttpRequest::Failure, e.right()->output().str()});
} }
}, });
output);
}, },
callback); callback);
} }
......
...@@ -33,18 +33,16 @@ DeleteItemRequest::DeleteItemRequest(std::shared_ptr<CloudProvider> p, ...@@ -33,18 +33,16 @@ DeleteItemRequest::DeleteItemRequest(std::shared_ptr<CloudProvider> p,
: Request(p) { : Request(p) {
set( set(
[=](Request::Pointer request) { [=](Request::Pointer request) {
auto output = std::make_shared<std::stringstream>();
sendRequest( sendRequest(
[=](util::Output stream) { [=](util::Output stream) {
return provider()->deleteItemRequest(*item, *stream); return provider()->deleteItemRequest(*item, *stream);
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) if (e.left())
request->done(e.left()); request->done(e.left());
else else
request->done(nullptr); request->done(nullptr);
}, });
output);
}, },
callback); callback);
} }
......
...@@ -48,7 +48,7 @@ DownloadFileRequest::DownloadFileRequest(std::shared_ptr<CloudProvider> p, ...@@ -48,7 +48,7 @@ DownloadFileRequest::DownloadFileRequest(std::shared_ptr<CloudProvider> p,
util::range_to_string(range)); util::range_to_string(range));
return request; return request;
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) if (e.left())
request->done(e.left()); request->done(e.left());
else else
...@@ -91,7 +91,7 @@ DownloadFileFromUrlRequest::DownloadFileFromUrlRequest( ...@@ -91,7 +91,7 @@ DownloadFileFromUrlRequest::DownloadFileFromUrlRequest(
r->setHeaderParameter("Range", util::range_to_string(range)); r->setHeaderParameter("Range", util::range_to_string(range));
return r; return r;
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
if (e.left()) if (e.left())
cb(e.left()); cb(e.left());
else else
......
...@@ -33,22 +33,20 @@ GetItemDataRequest::GetItemDataRequest(std::shared_ptr<CloudProvider> p, ...@@ -33,22 +33,20 @@ GetItemDataRequest::GetItemDataRequest(std::shared_ptr<CloudProvider> p,
: Request(p) { : Request(p) {
set( set(
[=](Request::Pointer request) { [=](Request::Pointer request) {
auto response_stream = std::make_shared<std::stringstream>();
sendRequest( sendRequest(
[=](util::Output input) { [=](util::Output input) {
return provider()->getItemDataRequest(id, *input); return provider()->getItemDataRequest(id, *input);
}, },
[=](EitherError<util::Output> r) { [=](EitherError<Response> r) {
if (r.left()) return request->done(r.left()); if (r.left()) return request->done(r.left());
try { try {
request->done( request->done(
provider()->getItemDataResponse(*response_stream)); provider()->getItemDataResponse(r.right()->output()));
} catch (std::exception) { } catch (std::exception) {
request->done( request->done(
Error{IHttpRequest::Failure, response_stream->str()}); Error{IHttpRequest::Failure, r.right()->output().str()});
} }
}, });
response_stream);
}, },
callback); callback);
} }
......
...@@ -36,8 +36,8 @@ GetItemUrlRequest::GetItemUrlRequest(std::shared_ptr<CloudProvider> p, ...@@ -36,8 +36,8 @@ GetItemUrlRequest::GetItemUrlRequest(std::shared_ptr<CloudProvider> p,
if (item->type() == IItem::FileType::Directory) if (item->type() == IItem::FileType::Directory)
return r->done(Error{IHttpRequest::ServiceUnavailable, return r->done(Error{IHttpRequest::ServiceUnavailable,
"url not provided for directory"}); "url not provided for directory"});
if (!provider()->getItemUrlRequest( std::stringstream dummy;
*item, *std::make_shared<std::stringstream>())) { if (!provider()->getItemUrlRequest(*item, dummy)) {
auto url = static_cast<Item*>(item.get())->url(); auto url = static_cast<Item*>(item.get())->url();
if (url.empty()) if (url.empty())
return r->done( return r->done(
...@@ -45,25 +45,25 @@ GetItemUrlRequest::GetItemUrlRequest(std::shared_ptr<CloudProvider> p, ...@@ -45,25 +45,25 @@ GetItemUrlRequest::GetItemUrlRequest(std::shared_ptr<CloudProvider> p,
else else
return r->done(url); return r->done(url);
} }
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output input) { [=](util::Output input) {
return provider()->getItemUrlRequest(*item, *input); return provider()->getItemUrlRequest(*item, *input);
}, },
[=](EitherError<util::Output> e) { [=](EitherError<Response> e) {
try { try {
if (e.left()) if (e.left())
r->done(e.left()); r->done(e.left());
else { else {
auto url = provider()->getItemUrlResponse(*item, *output); auto url = provider()->getItemUrlResponse(
*item, e.right()->output());
static_cast<Item*>(item.get())->set_url(url); static_cast<Item*>(item.get())->set_url(url);
r->done(url); r->done(url);
} }
} catch (std::exception) { } catch (std::exception) {
r->done(Error{IHttpRequest::Failure, output->str()}); r->done(
Error{IHttpRequest::Failure, e.right()->output().str()});
} }
}, });
output);
}, },
callback); callback);
} }
......
...@@ -36,25 +36,28 @@ ListDirectoryPageRequest::ListDirectoryPageRequest( ...@@ -36,25 +36,28 @@ ListDirectoryPageRequest::ListDirectoryPageRequest(
[=](Request<EitherError<PageData>>::Pointer r) { [=](Request<EitherError<PageData>>::Pointer r) {
if (directory->type() != IItem::FileType::Directory) if (directory->type() != IItem::FileType::Directory)
return r->done(Error{IHttpRequest::Bad, "file not a directory"}); return r->done(Error{IHttpRequest::Bad, "file not a directory"});
auto output = std::make_shared<std::stringstream>();
r->sendRequest( r->sendRequest(
[=](util::Output input) { [=](util::Output input) {
return r->provider()->listDirectoryRequest(*directory, token, return r->provider()->listDirectoryRequest(*directory, token,
*input); *input);