Skip to content

Commit

Permalink
Upgrade to support HTTP.jl 1.0 release (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnj authored Aug 16, 2022
1 parent 7d857e5 commit 0d1a041
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ ZMQ = "c2297ded-f4af-51ae-bb23-16f91089e4e1"

[compat]
AutoHashEquals = "0.2"
GitForge = "~0.1.6"
GitForge = "~0.1.8"
GitHub = "5.7.0"
HTTP = "0.8, 0.9"
HTTP = "0.8, 0.9, 1"
JSON = "0.20, 0.21"
MbedTLS = "0.6.8, 0.7, 1"
Mocking = "0.7"
Mustache = "0.5, 1.0"
Mux = "0.7"
Mux = "0.7, 1"
RegistryTools = "1.8"
TimeToLive = "0.2, 0.3"
ZMQ = "1"
Expand Down
2 changes: 1 addition & 1 deletion src/webui/WebUI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ end
error_handler(f::Function, r::HTTP.Request) = try
f(r)
catch e
@error "Handler error" route=r.target exception=get_backtrace(e)
@error "Handler error" route=r.target exception=(e, catch_backtrace())
html(500, "Server error, sorry!")
end

Expand Down
9 changes: 8 additions & 1 deletion src/webui/routes/auth.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# HTTP compat
if isdefined(HTTP, :stringify)
const stringify = HTTP.stringify
else
const stringify = String
end

# Step 2: Redirect to provider.
function auth(r::HTTP.Request)
pkey = getquery(r, "provider")
Expand All @@ -16,7 +23,7 @@ function auth(r::HTTP.Request)

state = String(rand('a':'z', 32))
return HTTP.Response(307, [
"Set-Cookie" => String(HTTP.Cookie("state", state; path="/"), false),
"Set-Cookie" => stringify(HTTP.Cookie("state", state; path="/"), false),
"Location" => provider.auth_url * "?" * HTTP.escapeuri(Dict(
:response_type => "code",
:client_id => provider.client_id,
Expand Down
1 change: 0 additions & 1 deletion test/webui/gitutils.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Dates: DateTime
using Registrator.WebUI: isauthorized, AuthFailure, AuthSuccess, User
using GitForge: GitForge, GitHub, GitLab
using HTTP: stacktrace

using Mocking

Expand Down

0 comments on commit 0d1a041

Please sign in to comment.