Provide unparsed URL
varnerac opened this issue · 7 comments
Currently, we get the path back as a list of tokens in the path
field of Raxx.Request
.
Some applications forbid or require a trailing slash in a URL (e.g. TAXII 2.0 requires it). Without access to the unparsed path, I can't verify if a request is valid.
I'd like access to the unparsed URL in Raxx.Request
Would getting the path with empty segments be sufficient. i.e. ["foo", ""]
and ["foo"]
for "foo/"
vs `"foo". I've though about ace building requests like that then have a compact middleware of similar in the Raxx project
It would be sufficient, but it doesn't seem "natural". I may want to know if the last character is /
. In that case, looking for ""
at the end of the path tokens seems like an odd way to check it. It also seems unnatural to folks who are already matching on path tokens to have to handle the ""
. I'd prefer a plain, string path, or even entire URL.
Fair enough. I'm hesitant to duplicate data in the request struct (i.e. having a segments and string path) however I do think it should be possible to access the raw path. Am open to ideas about how to expose it.
@CrowdHailer
Having the raw path is valuable in the request, sometimes we have to reconstruct that ourselves anyway.
Also, it solves the issues of foo/bar
or foo/bar/
easily
Check sections 5 and 6 here on path normalisation https://tools.ietf.org/html/rfc3986#section-5
Do you want to add path normalization in the path segments middleware?
Closed by #106