| 20 | { |
| 21 | |
| 22 | DB::ReadWriteBufferFromHTTPPtr createReadBuffer( |
| 23 | const std::string & endpoint, |
| 24 | DB::ContextPtr context, |
| 25 | const Poco::Net::HTTPBasicCredentials & credentials, |
| 26 | const Poco::URI::QueryParameters & params, |
| 27 | const DB::HTTPHeaderEntries & headers, |
| 28 | const std::string & method, |
| 29 | std::function<void(std::ostream &)> out_stream_callaback) |
| 30 | { |
| 31 | Poco::URI url(endpoint); |
| 32 | if (!params.empty()) |
| 33 | url.setQueryParameters(params); |
| 34 | |
| 35 | return DB::BuilderRWBufferFromHTTP(url) |
| 36 | .withConnectionGroup(DB::HTTPConnectionGroupType::HTTP) |
| 37 | .withSettings(context->getReadSettings()) |
| 38 | .withTimeouts(DB::ConnectionTimeouts::getHTTPTimeouts(context->getSettingsRef(), context->getServerSettings())) |
| 39 | .withHostFilter(&context->getRemoteHostFilter()) |
| 40 | .withHeaders(headers) |
| 41 | .withDelayInit(false) |
| 42 | .withSkipNotFound(false) |
| 43 | .withMethod(method) |
| 44 | .withOutCallback(out_stream_callaback) |
| 45 | .create(credentials); |
| 46 | } |
| 47 | |
| 48 | std::pair<Poco::Dynamic::Var, std::string> makeHTTPRequestAndReadJSON( |
| 49 | const std::string & endpoint, |
no test coverage detected