mirror of
				https://github.com/esphome/esphome.git
				synced 2025-11-04 00:51:49 +00:00 
			
		
		
		
	Merge branch 'http_request_const' into integration
This commit is contained in:
		@@ -167,8 +167,8 @@ class HttpRequestComponent : public Component {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 protected:
 | 
			
		||||
  virtual std::shared_ptr<HttpContainer> perform(std::string url, std::string method, std::string body,
 | 
			
		||||
                                                 std::list<Header> request_headers,
 | 
			
		||||
  virtual std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method,
 | 
			
		||||
                                                 const std::string &body, const std::list<Header> &request_headers,
 | 
			
		||||
                                                 std::set<std::string> collect_headers) = 0;
 | 
			
		||||
  const char *useragent_{nullptr};
 | 
			
		||||
  bool follow_redirects_{};
 | 
			
		||||
 
 | 
			
		||||
@@ -14,8 +14,9 @@ namespace http_request {
 | 
			
		||||
 | 
			
		||||
static const char *const TAG = "http_request.arduino";
 | 
			
		||||
 | 
			
		||||
std::shared_ptr<HttpContainer> HttpRequestArduino::perform(std::string url, std::string method, std::string body,
 | 
			
		||||
                                                           std::list<Header> request_headers,
 | 
			
		||||
std::shared_ptr<HttpContainer> HttpRequestArduino::perform(const std::string &url, const std::string &method,
 | 
			
		||||
                                                           const std::string &body,
 | 
			
		||||
                                                           const std::list<Header> &request_headers,
 | 
			
		||||
                                                           std::set<std::string> collect_headers) {
 | 
			
		||||
  if (!network::is_connected()) {
 | 
			
		||||
    this->status_momentary_error("failed", 1000);
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,8 @@ class HttpContainerArduino : public HttpContainer {
 | 
			
		||||
 | 
			
		||||
class HttpRequestArduino : public HttpRequestComponent {
 | 
			
		||||
 protected:
 | 
			
		||||
  std::shared_ptr<HttpContainer> perform(std::string url, std::string method, std::string body,
 | 
			
		||||
                                         std::list<Header> request_headers,
 | 
			
		||||
  std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body,
 | 
			
		||||
                                         const std::list<Header> &request_headers,
 | 
			
		||||
                                         std::set<std::string> collect_headers) override;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -17,8 +17,9 @@ namespace http_request {
 | 
			
		||||
 | 
			
		||||
static const char *const TAG = "http_request.host";
 | 
			
		||||
 | 
			
		||||
std::shared_ptr<HttpContainer> HttpRequestHost::perform(std::string url, std::string method, std::string body,
 | 
			
		||||
                                                        std::list<Header> request_headers,
 | 
			
		||||
std::shared_ptr<HttpContainer> HttpRequestHost::perform(const std::string &url, const std::string &method,
 | 
			
		||||
                                                        const std::string &body,
 | 
			
		||||
                                                        const std::list<Header> &request_headers,
 | 
			
		||||
                                                        std::set<std::string> response_headers) {
 | 
			
		||||
  if (!network::is_connected()) {
 | 
			
		||||
    this->status_momentary_error("failed", 1000);
 | 
			
		||||
 
 | 
			
		||||
@@ -18,8 +18,8 @@ class HttpContainerHost : public HttpContainer {
 | 
			
		||||
 | 
			
		||||
class HttpRequestHost : public HttpRequestComponent {
 | 
			
		||||
 public:
 | 
			
		||||
  std::shared_ptr<HttpContainer> perform(std::string url, std::string method, std::string body,
 | 
			
		||||
                                         std::list<Header> request_headers,
 | 
			
		||||
  std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body,
 | 
			
		||||
                                         const std::list<Header> &request_headers,
 | 
			
		||||
                                         std::set<std::string> response_headers) override;
 | 
			
		||||
  void set_ca_path(const char *ca_path) { this->ca_path_ = ca_path; }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -52,8 +52,9 @@ esp_err_t HttpRequestIDF::http_event_handler(esp_http_client_event_t *evt) {
 | 
			
		||||
  return ESP_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::shared_ptr<HttpContainer> HttpRequestIDF::perform(std::string url, std::string method, std::string body,
 | 
			
		||||
                                                       std::list<Header> request_headers,
 | 
			
		||||
std::shared_ptr<HttpContainer> HttpRequestIDF::perform(const std::string &url, const std::string &method,
 | 
			
		||||
                                                       const std::string &body,
 | 
			
		||||
                                                       const std::list<Header> &request_headers,
 | 
			
		||||
                                                       std::set<std::string> collect_headers) {
 | 
			
		||||
  if (!network::is_connected()) {
 | 
			
		||||
    this->status_momentary_error("failed", 1000);
 | 
			
		||||
 
 | 
			
		||||
@@ -37,8 +37,8 @@ class HttpRequestIDF : public HttpRequestComponent {
 | 
			
		||||
  void set_buffer_size_tx(uint16_t buffer_size_tx) { this->buffer_size_tx_ = buffer_size_tx; }
 | 
			
		||||
 | 
			
		||||
 protected:
 | 
			
		||||
  std::shared_ptr<HttpContainer> perform(std::string url, std::string method, std::string body,
 | 
			
		||||
                                         std::list<Header> request_headers,
 | 
			
		||||
  std::shared_ptr<HttpContainer> perform(const std::string &url, const std::string &method, const std::string &body,
 | 
			
		||||
                                         const std::list<Header> &request_headers,
 | 
			
		||||
                                         std::set<std::string> collect_headers) override;
 | 
			
		||||
  // if zero ESP-IDF will use DEFAULT_HTTP_BUF_SIZE
 | 
			
		||||
  uint16_t buffer_size_rx_{};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user