MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / create_http_module

Function create_http_module

aiscript-vm/src/stdlib/http.rs:16–32  ·  view source on GitHub ↗
(ctx: Context)

Source from the content-addressed store, hash-verified

14};
15
16pub fn create_http_module(ctx: Context) -> ModuleKind {
17 let name = ctx.intern(b"std.http");
18
19 let exports = [
20 ("get", Value::NativeFunction(NativeFn(http_get))),
21 ("post", Value::NativeFunction(NativeFn(http_post))),
22 ("put", Value::NativeFunction(NativeFn(http_put))),
23 ("delete", Value::NativeFunction(NativeFn(http_delete))),
24 ("patch", Value::NativeFunction(NativeFn(http_patch))),
25 ("head", Value::NativeFunction(NativeFn(http_head))),
26 ]
27 .into_iter()
28 .map(|(name, f)| (ctx.intern_static(name), f))
29 .collect();
30
31 ModuleKind::Native { name, exports }
32}
33
34fn parse_headers(
35 headers: HashMap<InternedString, Value, BuildHasherDefault<AHasher>>,

Callers 1

init_stdlibMethod · 0.85

Calls 3

NativeFnClass · 0.85
internMethod · 0.45
intern_staticMethod · 0.45

Tested by

no test coverage detected