Repository navigation
add table params support to url join and url build-query - #14239
Merged
Merged
Conversation
Transforms key value pairs in the form `table<key, value>` into a query string [[key, value]; [a, one], [a, two], [b, three], ] => "a=one&a=two&b=three"
- `value`'s span can be derived from `value` and does not need to be supplied separately - however head span can not be derived from other parameters and may be used error messages
NOTE: This means previously allowed single row table inputs which worked the same as record inputs are no longer accepted.
Also reduce nesting in code.
- update invalid param error check to be more specific - add check for list values in params - add check for valid and invalid tables as params
fdncred
reviewed
Nov 3, 2024
fdncred
reviewed
Nov 3, 2024
Co-authored-by: Darren Schroeder <[email protected]>
Member
Author
|
Looks like there are integration tests that expected "Mismatch, qs from params" in the error text |
Contributor
|
oops, sorry for breaking things. just thought query string was easier to understand. |
Contributor
|
conflicts now that your other pr landed, when you have time. |
Contributor
|
Thanks. |
NotTheDr01ds
pushed a commit
to NotTheDr01ds/nushell
that referenced
this pull request
Nov 8, 2024
…#14239) Add `table<key, value>` support to `url join` for the `params` field, and as input to `url build-query` nushell#14162 # Description ```nushell { "scheme": "http", "username": "usr", "password": "pwd", "host": "localhost", "params": [ ["key", "value"]; ["par_1", "aaa"], ["par_2", "bbb"], ["par_1", "ccc"], ["par_2", "ddd"], ], "port": "1234", } | url join ``` ``` http://usr:pwd@localhost:1234?par_1=aaa&par_2=bbb&par_1=ccc&par_2=ddd ``` --- ```nushell [ ["key", "value"]; ["par_1", "aaa"], ["par_2", "bbb"], ["par_1", "ccc"], ["par_2", "ddd"], ] | url build-query ``` ``` par_1=aaa&par_2=bbb&par_1=ccc&par_2=ddd ``` # User-Facing Changes ## `url build-query` - can no longer accept one row table input as if it were a record --------- Co-authored-by: Darren Schroeder <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
table<key, value>support tourl joinfor theparamsfield, and as input tourl build-query#14162Description
{ "scheme": "http", "username": "usr", "password": "pwd", "host": "localhost", "params": [ ["key", "value"]; ["par_1", "aaa"], ["par_2", "bbb"], ["par_1", "ccc"], ["par_2", "ddd"], ], "port": "1234", } | url join[ ["key", "value"]; ["par_1", "aaa"], ["par_2", "bbb"], ["par_1", "ccc"], ["par_2", "ddd"], ] | url build-queryUser-Facing Changes
url build-query