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

`url` field of the request is not set on the service side

Open findmyway opened this issue 2 years ago • 2 comments

MWE:

using HTTP
function handle(req)
    HTTP.Response(200, string(req.url))
end

router = HTTP.Router()
HTTP.register!(router, "/", handle)
server = HTTP.serve!(router, "127.0.0.1", 8122)

HTTP.get("http://127.0.0.1:8122") # empty result

findmyway avatar Mar 28 '23 05:03 findmyway

Hi Jun, I also stumbled upon this, concretely in Pluto - when adding query params to the url, they don't appear in the url but in the req.target field. I guess it is related to your MWE.

At least this means the documentation is wrong, it states url::URI, the full URI of the request, or it is a bug.

This looks crucial - @quinnj can you take a look?

schlichtanders avatar Oct 17 '23 08:10 schlichtanders

https://github.com/JuliaWeb/HTTP.jl/blob/5cd586d8fba2b4208b028aed832104443c1abd07/src/Handlers.jl#L391

Indeed, it's also used in the source code.

findmyway avatar Oct 18 '23 07:10 findmyway

dup of https://github.com/JuliaWeb/HTTP.jl/issues/1041 ?

bjarthur avatar May 14 '24 14:05 bjarthur