Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to support HTTP.jl 1.0 release #381

Merged
merged 1 commit into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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