Skip to content

Commit

Permalink
Nothing comparison improvement (#741)
Browse files Browse the repository at this point in the history
* improve nothing comparison

* rollback not nothing comarison
  • Loading branch information
AtsushiSakai authored Aug 13, 2021
1 parent 11bcccc commit 7a3d9c9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/download.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function try_get_filename_from_headers(resp)
# extract out of Content-Disposition line
# rough version of what is needed in https://github.com/JuliaWeb/HTTP.jl/issues/179
filename_part = match(r"filename\s*=\s*(.*)", content_disp)
if filename_part != nothing
if filename_part !== nothing
filename = filename_part[1]
quoted_filename = match(r"\"(.*)\"", filename)
if quoted_filename != nothing
if quoted_filename !== nothing
# It was in quotes, so it will be double escaped
filename = unescape_string(quoted_filename[1])
end
Expand Down
12 changes: 6 additions & 6 deletions test/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ import HTTP.URIs
end

withenv("HTTPS_PROXY"=>nothing, "https_proxy"=>nothing) do
@test HTTP.ConnectionRequest.getproxy("https", "https://julialang.org/") == nothing
@test HTTP.ConnectionRequest.getproxy("https", "https://julialang.org/") === nothing
end
withenv("HTTPS_PROXY"=>"") do
# to be compatible with Julia 1.0
@test HTTP.ConnectionRequest.getproxy("https", "https://julialang.org/") == nothing
@test HTTP.ConnectionRequest.getproxy("https", "https://julialang.org/") === nothing
end
withenv("https_proxy"=>"") do
@test HTTP.ConnectionRequest.getproxy("https", "https://julialang.org/") == nothing
@test HTTP.ConnectionRequest.getproxy("https", "https://julialang.org/") === nothing
end
withenv("HTTPS_PROXY"=>"https://user:pass@server:80") do
@test HTTP.ConnectionRequest.getproxy("https", "https://julialang.org/") == "https://user:pass@server:80"
Expand All @@ -54,13 +54,13 @@ import HTTP.URIs
end

withenv("HTTP_PROXY"=>nothing, "http_proxy"=>nothing) do
@test HTTP.ConnectionRequest.getproxy("http", "http://julialang.org/") == nothing
@test HTTP.ConnectionRequest.getproxy("http", "http://julialang.org/") === nothing
end
withenv("HTTP_PROXY"=>"") do
@test HTTP.ConnectionRequest.getproxy("http", "http://julialang.org/") == nothing
@test HTTP.ConnectionRequest.getproxy("http", "http://julialang.org/") === nothing
end
withenv("http_proxy"=>"") do
@test HTTP.ConnectionRequest.getproxy("http", "http://julialang.org/") == nothing
@test HTTP.ConnectionRequest.getproxy("http", "http://julialang.org/") === nothing
end
withenv("HTTP_PROXY"=>"http://user:pass@server:80") do
@test HTTP.ConnectionRequest.getproxy("http", "http://julialang.org/") == "http://user:pass@server:80"
Expand Down

0 comments on commit 7a3d9c9

Please sign in to comment.