Skip to content

Commit

Permalink
Test for single file
Browse files Browse the repository at this point in the history
  • Loading branch information
mishankov committed Aug 19, 2024
1 parent 8a16932 commit 72e9eb2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/int/test_yahttp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test "Test JSON body":

check jsonResp["json"]["key"].getStr() == "value"

test "Test body with toJson helper":
test "Test body with toJsonString helper":
type TestReq = object
field1: string
field2: int
Expand All @@ -57,3 +57,12 @@ test "Test timeout":

# No exception
discard get(BASE_URL & "/delay/5", timeout = -1)


test "Test sending single file":
let resp = post(BASE_URL & "/post", files = @[("my_file", "test.txt", "text/plain", "some file content")]).json()

check resp["files"]["my_file"][0].getStr() == "some file content"
check resp["data"].getStr().contains("test.txt")
check resp["data"].getStr().contains("text/plain")
check resp["data"].getStr().contains("some file content")

0 comments on commit 72e9eb2

Please sign in to comment.