upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/unit/stubs/http.h
blob: 753ebd8f281a2d65e68946a57aa4e67c8fa6a726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef STUBS_HTTP_H
#define STUBS_HTTP_H

#include "esp_err.h"
#include <stddef.h>

typedef struct {
    int status;
    char *body;
    size_t body_len;
} http_response_t;

static inline esp_err_t http_get(const char *url, http_response_t *resp)
{
    (void)url; (void)resp;
    return ESP_FAIL;
}

static inline esp_err_t http_post_json(const char *url, const char *json_body,
                                        http_response_t *resp)
{
    (void)url; (void)json_body; (void)resp;
    return ESP_FAIL;
}

static inline esp_err_t http_post_json_timeout(const char *url, const char *json_body,
                                                http_response_t *resp, int timeout_ms)
{
    (void)url; (void)json_body; (void)resp; (void)timeout_ms;
    return ESP_FAIL;
}

static inline void http_response_free(http_response_t *resp)
{
    if (resp && resp->body) {
        free(resp->body);
        resp->body = NULL;
    }
}

#endif