diff options
Diffstat (limited to 'tests/unit/stubs/http.h')
| -rw-r--r-- | tests/unit/stubs/http.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/unit/stubs/http.h b/tests/unit/stubs/http.h new file mode 100644 index 0000000..753ebd8 --- /dev/null +++ b/tests/unit/stubs/http.h | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | #ifndef STUBS_HTTP_H | ||
| 2 | #define STUBS_HTTP_H | ||
| 3 | |||
| 4 | #include "esp_err.h" | ||
| 5 | #include <stddef.h> | ||
| 6 | |||
| 7 | typedef struct { | ||
| 8 | int status; | ||
| 9 | char *body; | ||
| 10 | size_t body_len; | ||
| 11 | } http_response_t; | ||
| 12 | |||
| 13 | static inline esp_err_t http_get(const char *url, http_response_t *resp) | ||
| 14 | { | ||
| 15 | (void)url; (void)resp; | ||
| 16 | return ESP_FAIL; | ||
| 17 | } | ||
| 18 | |||
| 19 | static inline esp_err_t http_post_json(const char *url, const char *json_body, | ||
| 20 | http_response_t *resp) | ||
| 21 | { | ||
| 22 | (void)url; (void)json_body; (void)resp; | ||
| 23 | return ESP_FAIL; | ||
| 24 | } | ||
| 25 | |||
| 26 | static inline esp_err_t http_post_json_timeout(const char *url, const char *json_body, | ||
| 27 | http_response_t *resp, int timeout_ms) | ||
| 28 | { | ||
| 29 | (void)url; (void)json_body; (void)resp; (void)timeout_ms; | ||
| 30 | return ESP_FAIL; | ||
| 31 | } | ||
| 32 | |||
| 33 | static inline void http_response_free(http_response_t *resp) | ||
| 34 | { | ||
| 35 | if (resp && resp->body) { | ||
| 36 | free(resp->body); | ||
| 37 | resp->body = NULL; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | |||
| 41 | #endif | ||