Skip to content

Commit

Permalink
end-to-end tests for #167
Browse files Browse the repository at this point in the history
This adds end-to-end tests for the changes introduced in #167.

Verbose mode is switched off for these tests, but switching it on would show that not setting content-length headers results in chunked transfer encoding while setting it prevents that. Both tests should pass.
  • Loading branch information
tanmaykm authored and StefanKarpinski committed Dec 14, 2021
1 parent 55a0c39 commit 911368d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ include("setup.jl")
rm(file)
end

@testset "put from io" begin
url = "$server/put"
file = tempname()
write(file, "Hello, world!")
open(file) do io
# without any content-length headers results in a chunked transfer encoding for upload
resp, json = request_json(url, input=io)
@test json["url"] == url
@test json["data"] == read(file, String)
end
open(file) do io
# with content-length headers results in a non-chunked upload
resp, json = request_json(url, input=io, headers=["Content-Length"=>string(filesize(file))])
@test json["url"] == url
@test json["data"] == read(file, String)
end
rm(file)
end

@testset "redirected get" begin
url = "$server/get"
redirect = "$server/redirect-to?url=$(url_escape(url))"
Expand Down

0 comments on commit 911368d

Please sign in to comment.