HTTP.jl icon indicating copy to clipboard operation
HTTP.jl copied to clipboard

req.url is always URI("")

Open edyu opened this issue 2 years ago • 2 comments

When looking for the uri of the request :: HTTP.Request, it seems req.url is always URI(""), if I want the URI, I have to do URI(req.target).path in order to see it. It makes req.url completely useless.

edyu avatar May 05 '23 04:05 edyu

I'm assuming you mean server-side? Yeah, the .url field started out as a client-side property, but never got a good treatment on the server-side. If you want to make a PR, that would be welcome! Essentially in the default stream handler (in the Handlers.jl file), right before (or after) we do request.body = read(stream), we should also set the url field based on the example you gave above.

quinnj avatar May 23 '23 00:05 quinnj

I just submitted a PR and honestly it's only one line and you pretty much nailed on where to change it so feel bad for taking the credit. You can decide whether to go through the trouble of merging or you can just change it yourself. Thank you again.

edyu avatar May 24 '23 17:05 edyu