-
Notifications
You must be signed in to change notification settings - Fork 2.1k
url commands: inconsistencies and missing features #14162
Copy link
Copy link
Closed
Labels
A:networkingAll about our `http` and `url` commands and everything going accross the network.All about our `http` and `url` commands and everything going accross the network.category:enhancementNew feature or requestNew feature or requeststatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look
Milestone
Description
Related problem
-
There is no built-in counterpart to
url build-queryfor splitting a query string (though this is not hard to implement in nushell) -
url join's handling of parameters don't matchurl build-query, specifically it doesn't support lists -
url parsecan create records with duplicate keys> "http://host?a=1&b=2&b=3" | url parse | get params ╭───┬───╮ │ a │ 1 │ │ b │ 2 │ │ b │ 3 │ ╰───┴───╯
Describe the solution you'd like
-
provide
url split-queryeither as a built-in or as a std functiondef "url split-query" []: [string -> table<key: string, value: string>] { split row '&' | split column '=' -n 2 key value | update cells { url decode } }
-
url joinandurl build-queryshould use a common implementation. -
url parse'sparamsshould either:- group the same keys into a list.
- instead of a record, be a key-value table. (
table<key: string, value: string>)
second option seems preferable as it would preserve order of parameters, which might carry meaning in different APIs
-
if
url parse | get paramsreturns atable<key:string, value:string>,url joinshould also support the same in its input.
Describe alternatives you've considered
No response
Additional context and details
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A:networkingAll about our `http` and `url` commands and everything going accross the network.All about our `http` and `url` commands and everything going accross the network.category:enhancementNew feature or requestNew feature or requeststatus:needs-triageAn issue that hasn't had any proper lookAn issue that hasn't had any proper look