Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_simple() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "",
|
|
|
|
"password": "",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": "",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "http://localhost");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_only_user() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": "",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
2024-01-31 23:52:23 +01:00
|
|
|
assert_eq!(actual.out, "http://usr@localhost");
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_only_pwd() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": "",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "http://localhost");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_user_and_pwd() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": "",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "http://usr:pwd@localhost");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_query() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"query": "par_1=aaa&par_2=bbb"
|
|
|
|
"port": "",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "http://usr:pwd@localhost?par_1=aaa&par_2=bbb");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_params() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"params": {
|
|
|
|
"par_1": "aaa",
|
|
|
|
"par_2": "bbb"
|
|
|
|
},
|
|
|
|
"port": "1234",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
actual.out,
|
|
|
|
"http://usr:pwd@localhost:1234?par_1=aaa&par_2=bbb"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_same_query_and_params() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"query": "par_1=aaa&par_2=bbb",
|
|
|
|
"params": {
|
|
|
|
"par_1": "aaa",
|
|
|
|
"par_2": "bbb"
|
|
|
|
},
|
|
|
|
"port": "1234",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
actual.out,
|
|
|
|
"http://usr:pwd@localhost:1234?par_1=aaa&par_2=bbb"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_different_query_and_params() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"query": "par_1=aaa&par_2=bbb",
|
|
|
|
"params": {
|
|
|
|
"par_1": "aaab",
|
|
|
|
"par_2": "bbb"
|
|
|
|
},
|
|
|
|
"port": "1234",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert!(actual
|
|
|
|
.err
|
|
|
|
.contains("Mismatch, qs from params is: ?par_1=aaab&par_2=bbb"));
|
|
|
|
assert!(actual
|
|
|
|
.err
|
|
|
|
.contains("instead query is: ?par_1=aaa&par_2=bbb"));
|
|
|
|
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"params": {
|
|
|
|
"par_1": "aaab",
|
|
|
|
"par_2": "bbb"
|
|
|
|
},
|
|
|
|
"query": "par_1=aaa&par_2=bbb",
|
|
|
|
"port": "1234",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert!(actual
|
|
|
|
.err
|
|
|
|
.contains("Mismatch, query param is: par_1=aaa&par_2=bbb"));
|
|
|
|
assert!(actual
|
|
|
|
.err
|
|
|
|
.contains("instead qs from params is: ?par_1=aaab&par_2=bbb"));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_invalid_params() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"params": "aaa",
|
|
|
|
"port": "1234",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert!(actual.err.contains("Key params has to be a record"));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_port() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": "1234",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "http://localhost:1234");
|
|
|
|
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": 1234,
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "http://localhost:1234");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_invalid_port() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": "aaaa",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert!(actual
|
|
|
|
.err
|
2023-10-03 18:24:32 +02:00
|
|
|
.contains("Port parameter should represent an unsigned int"));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"host": "localhost",
|
|
|
|
"port": [],
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert!(actual
|
|
|
|
.err
|
2023-10-03 18:24:32 +02:00
|
|
|
.contains("Port parameter should be an unsigned int or a string representing it"));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_missing_scheme() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"host": "localhost"
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert!(actual.err.contains("missing parameter: scheme"));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_missing_host() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "https"
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert!(actual.err.contains("missing parameter: host"));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_fragment() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"fragment": "frag",
|
|
|
|
"port": "1234",
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "http://usr:pwd@localhost:1234#frag");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_fragment_and_params() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
{
|
|
|
|
"scheme": "http",
|
|
|
|
"username": "usr",
|
|
|
|
"password": "pwd",
|
|
|
|
"host": "localhost",
|
|
|
|
"params": {
|
|
|
|
"par_1": "aaa",
|
|
|
|
"par_2": "bbb"
|
|
|
|
},
|
|
|
|
"port": "1234",
|
|
|
|
"fragment": "frag"
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
Feat/7725 url join (#7823)
# Description
Added command: `url join`.
Closes: #7725
# User-Facing Changes
```
Converts a record to url
Search terms: scheme, username, password, hostname, port, path, query, fragment
Usage:
> url join
Flags:
-h, --help - Display the help message for this command
Signatures:
<record> | url join -> <string>
Examples:
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "",
"password": "",
"host": "www.pixiv.net",
"port": "",
"path": "/member_illust.php",
"query": "mode=medium&illust_id=99260204",
"fragment": "",
"params":
{
"mode": "medium",
"illust_id": "99260204"
}
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"username": "user",
"password": "pwd",
"host": "www.pixiv.net",
"port": "1234",
"query": "test=a",
"fragment": ""
} | url join
Outputs a url representing the contents of this record
> {
"scheme": "http",
"host": "www.pixiv.net",
"port": "1234",
"path": "user",
"fragment": "frag"
} | url join
```
# Questions
- Which parameters should be required? Currenlty are: `scheme` and
`host`.
2023-01-22 19:49:40 +01:00
|
|
|
|
|
|
|
assert_eq!(
|
|
|
|
actual.out,
|
|
|
|
"http://usr:pwd@localhost:1234?par_1=aaa&par_2=bbb#frag"
|
|
|
|
);
|
|
|
|
}
|
2023-06-07 19:08:21 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn url_join_with_empty_params() {
|
2023-07-17 18:43:51 +02:00
|
|
|
let actual = nu!(pipeline(
|
|
|
|
r#"
|
2023-06-07 19:08:21 +02:00
|
|
|
{
|
|
|
|
"scheme": "https",
|
|
|
|
"host": "localhost",
|
|
|
|
"path": "/foo",
|
|
|
|
"params": {}
|
|
|
|
} | url join
|
|
|
|
"#
|
2023-07-17 18:43:51 +02:00
|
|
|
));
|
2023-06-07 19:08:21 +02:00
|
|
|
|
|
|
|
assert_eq!(actual.out, "https://localhost/foo");
|
|
|
|
}
|