Skip to content

Fix path params uri unescape #28

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

Merged
merged 2 commits into from
May 31, 2023
Merged
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
4 changes: 2 additions & 2 deletions src/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ function prep_args(ctx::Ctx)
body = to_json(ctx.body)
elseif ("application/x-www-form-urlencoded" == ctx.header["Content-Type"]) && isa(ctx.body, Dict)
body = URIs.escapeuri(ctx.body)
elseif isa(ctx.boody, APIModel) && isempty(get(ctx.header, "Content-Type", ""))
elseif isa(ctx.body, APIModel) && isempty(get(ctx.header, "Content-Type", ""))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops! thanks for catching this

headers["Content-Type"] = "application/json"
body = to_json(ctx.body)
else
Expand Down Expand Up @@ -335,7 +335,7 @@ function do_request(ctx::Ctx, stream::Bool=false; stream_to::Union{Channel,Nothi
# prepare the url
resource_path = replace(ctx.resource, "{format}"=>"json")
for (k,v) in ctx.path
resource_path = replace(resource_path, "{$k}"=>v)
resource_path = replace(resource_path, "{$k}"=>escapeuri(v))
end
# append query params if needed
if !isempty(ctx.query)
Expand Down