SolarEnergy/esp32_device/main/http_client.h

47 lines
804 B
C

/**
* HTTP client
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C"
{
#endif
enum method
{
MethodGET = 0,
MethodPOST
};
typedef struct
{
const char *url;
char *root_ca;
const char *body;
const char *content_type;
enum method method;
} http_request_opts;
/**
* Perform an HTTP request.
*
* Returns NULL in case of failure or the response else. The memory
* must be released by the caller.
*/
char *http_client_exec(const http_request_opts *opts);
/**
* Escape URI string
*
* See protocol_example_utils.c of esp32-idf
*/
size_t http_client_escape_uri(unsigned char *dst, const unsigned char *src, size_t size);
#ifdef __cplusplus
}
#endif