Description Related problem
There is no built-in counterpart to url build-query for splitting a query string (though this is not hard to implement in nushell)
url join's handling of parameters don't match url build-query, specifically it doesn't support lists
url parse can 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-query either as a built-in or as a std function
def "url split-query" []: [string - > table <key : string , value : string >] {
split row ' &'
| split column ' =' - n 2 key value
| update cells { url decode }
}
url join and url build-query should use a common implementation.
url parse's params should 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 params returns a table<key:string, value:string>, url join should also support the same in its input.
Describe alternatives you've considered
No response
Additional context and details
No response
Reactions are currently unavailable
You can’t perform that action at this time.
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 listsurl parsecan create records with duplicate keysDescribe the solution you'd like
provide
url split-queryeither as a built-in or as a std functionurl joinandurl build-queryshould use a common implementation.url parse'sparamsshould either: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