OpenMS
Loading...
Searching...
No Matches
NetworkGetRequest.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
11#include <OpenMS/config.h>
12
13#include <string>
14#include <vector>
15
16namespace OpenMS
17{
19 class OPENMS_DLLAPI NetworkGetRequest
20 {
21 public:
24
26 void setUrl(const std::string& url);
27
29 void setTimeout(int seconds);
30
32 void run();
33
35 std::string getResponse() const;
36
38 const std::vector<char>& getResponseBinary() const;
39
41 bool hasError() const;
42
44 std::string getErrorString() const;
45
46 private:
49
50 std::vector<char> response_bytes_;
51 std::string url_;
52 int timeout_ = 0;
53 bool has_error_ = false;
54 std::string error_string_;
55 };
56}
Synchronous HTTP GET request using libcurl.
Definition NetworkGetRequest.h:20
NetworkGetRequest(const NetworkGetRequest &)=delete
const std::vector< char > & getResponseBinary() const
returns the raw response bytes
void run()
execute the GET request (blocks until complete or timeout)
std::string url_
Definition NetworkGetRequest.h:51
void setTimeout(int seconds)
set the timeout in seconds (0 = no timeout)
std::string error_string_
Definition NetworkGetRequest.h:54
std::string getResponse() const
returns the response as a string
std::vector< char > response_bytes_
Definition NetworkGetRequest.h:50
bool hasError() const
returns true if an error occurred during the query
void setUrl(const std::string &url)
set the URL to request
std::string getErrorString() const
returns the error message
NetworkGetRequest & operator=(const NetworkGetRequest &)=delete
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19