ESPHome  2024.11.0
Data Structures | Enumerations | Functions
esphome::http_request Namespace Reference

Data Structures

struct  Header
 
class  HttpContainer
 
class  HttpContainerArduino
 
class  HttpContainerIDF
 
class  HttpRequestArduino
 
class  HttpRequestComponent
 
class  HttpRequestIDF
 
class  HttpRequestResponseTrigger
 
class  HttpRequestSendAction
 
class  HttpRequestUpdate
 
class  OtaHttpRequestComponent
 
class  OtaHttpRequestComponentFlashAction
 

Enumerations

enum  HttpStatus {
  HTTP_STATUS_OK = 200, HTTP_STATUS_NO_CONTENT = 204, HTTP_STATUS_PARTIAL_CONTENT = 206, HTTP_STATUS_MULTIPLE_CHOICES = 300,
  HTTP_STATUS_MOVED_PERMANENTLY = 301, HTTP_STATUS_FOUND = 302, HTTP_STATUS_SEE_OTHER = 303, HTTP_STATUS_NOT_MODIFIED = 304,
  HTTP_STATUS_TEMPORARY_REDIRECT = 307, HTTP_STATUS_PERMANENT_REDIRECT = 308, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_UNAUTHORIZED = 401,
  HTTP_STATUS_FORBIDDEN = 403, HTTP_STATUS_NOT_FOUND = 404, HTTP_STATUS_METHOD_NOT_ALLOWED = 405, HTTP_STATUS_NOT_ACCEPTABLE = 406,
  HTTP_STATUS_LENGTH_REQUIRED = 411, HTTP_STATUS_INTERNAL_ERROR = 500
}
 
enum  OtaHttpRequestError : uint8_t { OTA_MD5_INVALID = 0x10, OTA_BAD_URL = 0x11, OTA_CONNECTION_ERROR = 0x12 }
 

Functions

bool is_redirect (int const status)
 Returns true if the HTTP status code is a redirect. More...
 
bool is_success (int const status)
 Checks if the given HTTP status code indicates a successful request. More...
 

Enumeration Type Documentation

◆ HttpStatus

Enumerator
HTTP_STATUS_OK 
HTTP_STATUS_NO_CONTENT 
HTTP_STATUS_PARTIAL_CONTENT 
HTTP_STATUS_MULTIPLE_CHOICES 
HTTP_STATUS_MOVED_PERMANENTLY 
HTTP_STATUS_FOUND 
HTTP_STATUS_SEE_OTHER 
HTTP_STATUS_NOT_MODIFIED 
HTTP_STATUS_TEMPORARY_REDIRECT 
HTTP_STATUS_PERMANENT_REDIRECT 
HTTP_STATUS_BAD_REQUEST 
HTTP_STATUS_UNAUTHORIZED 
HTTP_STATUS_FORBIDDEN 
HTTP_STATUS_NOT_FOUND 
HTTP_STATUS_METHOD_NOT_ALLOWED 
HTTP_STATUS_NOT_ACCEPTABLE 
HTTP_STATUS_LENGTH_REQUIRED 
HTTP_STATUS_INTERNAL_ERROR 

Definition at line 26 of file http_request.h.

◆ OtaHttpRequestError

Enumerator
OTA_MD5_INVALID 
OTA_BAD_URL 
OTA_CONNECTION_ERROR 

Definition at line 19 of file ota_http_request.h.

Function Documentation

◆ is_redirect()

bool esphome::http_request::is_redirect ( int const  status)
inline

Returns true if the HTTP status code is a redirect.

Parameters
statusthe HTTP status code to check
Returns
true if the status code is a redirect, false otherwise

Definition at line 59 of file http_request.h.

◆ is_success()

bool esphome::http_request::is_success ( int const  status)
inline

Checks if the given HTTP status code indicates a successful request.

A successful request is one where the status code is in the range 200-299

Parameters
statusthe HTTP status code to check
Returns
true if the status code indicates a successful request, false otherwise

Definition at line 80 of file http_request.h.