Skip to content

Commit c0e8b33

Browse files
committed
fix: convert to Dict for JSON compat
1 parent 9b180c6 commit c0e8b33

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/PkgAuthentication.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function get_auth_configuration(state::NoAuthentication)
233233
body = nothing
234234
content = String(take!(output))
235235
try
236-
body = JSON.parse(content)
236+
body = Dict(JSON.parse(content))
237237
catch ex
238238
@debug "Request for well known configuration returned: ", content
239239
return Dict{String, Any}()
@@ -298,7 +298,7 @@ function fetch_device_code(
298298
body = nothing
299299
content = String(take!(output))
300300
try
301-
body = JSON.parse(content)
301+
body = Dict(JSON.parse(content))
302302
catch ex
303303
@debug "Request for device code returned: ", content
304304
return false, "", response
@@ -599,7 +599,7 @@ function step(state::ClaimToken)::Union{ClaimToken, HasNewToken, Failure}
599599

600600
if response isa Downloads.Response && response.status == 200 && !is_device
601601
body = try
602-
JSON.parse(String(take!(output)))
602+
Dict(JSON.parse(String(take!(output))))
603603
catch err
604604
return ClaimToken(
605605
state.server,
@@ -651,7 +651,7 @@ function step(state::ClaimToken)::Union{ClaimToken, HasNewToken, Failure}
651651
)
652652
end
653653
elseif response isa Downloads.Response && response.status == 200
654-
body = JSON.parse(String(take!(output)))
654+
body = Dict(JSON.parse(String(take!(output))))
655655
body["expires"] = body["expires_in"] + Int(floor(time()))
656656
body["expires_at"] = body["expires"]
657657
body["refresh_url"] = state.device_token_refresh_url
@@ -683,6 +683,7 @@ end
683683
struct GenericError{T} <: Failure
684684
reason::T
685685
end
686+
Base.show(io::IO, err::GenericError{<:Tuple}) = Base.showerror(io, err.reason[1], err.reason[2]; backtrace=true)
686687

687688
abstract type HttpError <: Failure end
688689

0 commit comments

Comments
 (0)