MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1#ifndef REQUEST_H
2#define REQUEST_H
3
4#include <stdint.h>
5#include <stddef.h>
6#include <stdbool.h>
7#include "types.h"
8#include "modules/url.h"
9
10typedef struct {
11 char *method;
12 url_state_t url;
13 char *referrer;
14 char *referrer_policy;
15 char *mode;
16 char *credentials;
17 char *cache;
18 char *redirect;
19 char *integrity;
20 bool keepalive;
21 bool reload_navigation;
22 bool history_navigation;
23 uint8_t *body_data;
24 size_t body_size;
25 char *body_type;
26 bool body_is_stream;
27 bool has_body;
28 bool body_used;
29} request_data_t;
30
31extern ant_value_t g_request_proto;
32void init_request_module(void);
33
34request_data_t *request_get_data(ant_value_t obj);
35ant_value_t request_get_headers(ant_value_t obj);
36ant_value_t request_get_signal(ant_t *js, ant_value_t obj);
37
38ant_value_t request_create_from_input_init(
39 ant_t *js,
40 ant_value_t input,
41 ant_value_t init
42);
43
44ant_value_t request_create(
45 ant_t *js,
46 const char *method,
47 const char *url,
48 ant_value_t headers,
49 const uint8_t *body,
50 size_t body_len,
51 const char *body_type
52);
53
54ant_value_t request_create_server(
55 ant_t *js,
56 const char *method,
57 const char *target,
58 bool absolute_target,
59 const char *host,
60 const char *server_hostname,
61 int server_port,
62 ant_value_t headers,
63 const uint8_t *body,
64 size_t body_len,
65 const char *body_type
66);
67
68#endif