mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 22:40:01 -04:00
fix handling of request bodies
This commit is contained in:
parent
3a50060e07
commit
5e9f26f818
6 changed files with 32 additions and 8 deletions
|
@ -55,5 +55,8 @@ class JSTest(unittest.TestCase):
|
|||
def test_http_session(self):
|
||||
self.run_test("test_http_session.js")
|
||||
|
||||
def test_post(self):
|
||||
self.run_test("test_post.js")
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
10
client/tests/scripts/test_post.js
Normal file
10
client/tests/scripts/test_post.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
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");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue