Request query parameter storage #2
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Query parameters are currently stored in a
const(StringMultiValueMap)
.Abstraction
This implies that a server has to parse the query parameters for any given input URL in advance to populate the structure the way a user would expect. I wonder whether it would be better to separate the actual parsing from the request abstraction and make it opt-in.
oceandrift-http does this at the moment:
https://github.com/oceandrift/http/blob/v0.24.312/microframework/oceandrift/http/microframework/form.d#L124
https://github.com/oceandrift/http/blob/v0.24.312/microframework/oceandrift/http/microframework/uri.d#L50
PSR-7 leaves it up to the implementation how it is handled (by defining only the abstract interfaces):
https://www.php-fig.org/psr/psr-7/
Original order is lost
Another thing is:
adr has pointed out the following issue on Discord:
So you're suggesting that the
ServerHttpRequest
simply provides the full raw URL, and that users would be free to parse it however they like? And in that case, I'd provide convenience functions to parse the query parameters, path parameters, and other things which only some implementations may care about, right?I've pushed a commit which adds a
parseQueryParameters
function that takes a string and returns a list ofQueryParameter
structs, which is more appropriate. I've removed the query params from the request struct, and a user can now parse the query params if and when they need them.Yeah. Sounds like the most flexible approach to me.