deno.land / x / alosaur@v1.1.1 / e2e / form-data.test.ts

form-data.test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { assertEquals } from "../src/deps_test.ts";import { killServer, startServer } from "./test.utils.ts";const { test } = Deno;
/** * Test cases */test({ name: "[http] Form data send", async fn(): Promise<void> { const process = await startServer("./examples/form-data/app.ts"); const baseUrl = "http://localhost:8000";
try { const formData = new FormData(); formData.append("file", new File([new ArrayBuffer(1)], "test.txt"));
const r1 = await fetch(baseUrl, { method: "POST", body: formData, });
const text_r1 = await r1.text();
assertEquals(r1.status, 200); assertEquals(text_r1, "Uploaded"); } finally { killServer(process); } },});
alosaur

Version Info

Tagged at
2 months ago