libcurl.js/client/tests/scripts/test_post.js
2024-03-20 18:38:13 -04:00

10 lines
No EOL
342 B
JavaScript

async function test() {
let payload = "hello".repeat(100);
let r = await libcurl.fetch("https://httpbin.org/anything", {
method: "POST",
body: new Blob([payload], {type: "text/plain"})
});
assert(r.status === 200, "wrong status");
let json = await r.json();
assert(json.data === payload, "server reports wrong payload");
}