upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/unit/stubs/http.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/stubs/http.h')
-rw-r--r--tests/unit/stubs/http.h41
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
7typedef struct {
8 int status;
9 char *body;
10 size_t body_len;
11} http_response_t;
12
13static 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
19static 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
26static 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
33static 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