Page MenuHomeSealhub

http_request.ts
No OneTemporary

Authored By
Unknown
Size
481 B
Referenced Files
None
Subscribers
None

http_request.ts

// returning any as this function is only supposed to be used for tests
export async function post(
url: string,
body: Record<string, unknown>
): Promise<any> {
const response = await fetch(url, {
method: "post",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
});
if (!response.status.toString().startsWith("2")) {
throw { response: { data: await response.json(), ...response } };
}
const json = response.json();
return json;
}

File Metadata

Mime Type
application/javascript
Expires
Sat, Nov 7, 14:35 (20 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1181772
Default Alt Text
http_request.ts (481 B)

Event Timeline