Skip to content

Commit 0e2a0c5

Browse files
committed
Updating Postman schema to have domain and path optional on cookies. Allowing for null response bodies in Postman examples.
1 parent 5e0389f commit 0e2a0c5

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ impl<'a> Transpiler<'a> {
577577
existing_response.headers = Some(cloned_headers);
578578
}
579579

580-
let mut existing_content = existing_response.content.clone().unwrap();
580+
let mut existing_content =
581+
existing_response.content.clone().unwrap_or_default();
581582
for (media_type, new_content) in new_response.content.unwrap() {
582583
if let Some(existing_response_content) =
583584
existing_content.get_mut(&media_type)

src/postman/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ pub struct ResponseClass {
671671
pub struct Cookie {
672672
/// The domain for which this cookie is valid.
673673
#[serde(rename = "domain")]
674-
pub domain: String,
674+
pub domain: Option<String>,
675675

676676
/// When the cookie expires.
677677
#[serde(rename = "expires")]
@@ -701,7 +701,7 @@ pub struct Cookie {
701701

702702
/// The path associated with the Cookie.
703703
#[serde(rename = "path")]
704-
pub path: String,
704+
pub path: Option<String>,
705705

706706
/// Indicates if the 'secure' flag is set on the Cookie, meaning that it is transmitted over
707707
/// secure connections only. (typically HTTPS)

tests/fixtures/echo.postman.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3944,14 +3944,12 @@
39443944
{
39453945
"expires": "Invalid Date",
39463946
"httpOnly": true,
3947-
"domain": "postman-echo.com",
3948-
"path": "/",
39493947
"secure": false,
39503948
"value": "s%3A55y5Ll7HpTzt_hKuw6N54k4N04ilmMdn.uCPCHttP5DmI%2BdBw2I9NZL55lFFOzz4XxS4qAHv47gI",
39513949
"key": "sails.sid"
39523950
}
39533951
],
3954-
"body": "{\"id\":\"0c42230c-c8e4-4ca0-a4aa-d393971de8b8\",\"name\":\"Sample Postman Collection\",\"description\":\"A sample collection to demonstrate collections as a set of related requests\",\"order\":[\"3d04ed83-dc1e-40ec-923c-16aa92509e50\",\"e02f8160-fb41-4633-be80-cc7d701e85b4\",\"77bd6d4d-1060-4927-aa5c-dcdba7f750cf\"],\"folders\":[],\"requests\":[{\"id\":\"3d04ed83-dc1e-40ec-923c-16aa92509e50\",\"name\":\"A simple GET request\",\"collectionId\":\"1dd68aff-a3fa-4f52-904f-5b75053bc9d9\",\"method\":\"GET\",\"headers\":\"\",\"data\":[],\"rawModeData\":\"\",\"tests\":\"tests['response code is 200'] = (responseCode.code === 200);\",\"preRequestScript\":\"\",\"url\":\"https://postman-echo.com/get?source=newman-sample-github-collection\"},{\"id\":\"e02f8160-fb41-4633-be80-cc7d701e85b4\",\"name\":\"A simple POST request\",\"collectionId\":\"1dd68aff-a3fa-4f52-904f-5b75053bc9d9\",\"method\":\"POST\",\"headers\":\"Content-Type: text/plain\",\"dataMode\":\"raw\",\"data\":[],\"rawModeData\":\"Duis posuere augue vel cursus pharetra. In luctus a ex nec pretium...\",\"url\":\"https://postman-echo.com/post\"},{\"id\":\"77bd6d4d-1060-4927-aa5c-dcdba7f750cf\",\"name\":\"A simple POST request with JSON body\",\"collectionId\":\"1dd68aff-a3fa-4f52-904f-5b75053bc9d9\",\"method\":\"POST\",\"headers\":\"Content-Type: application/json\",\"dataMode\":\"raw\",\"data\":[],\"rawModeData\":\"{\\\"text\\\":\\\"Duis posuere augue vel cursus pharetra. In luctus a ex nec pretium...\\\"}\",\"url\":\"https://postman-echo.com/post\"}]}"
3952+
"body": null
39553953
}
39563954
]
39573955
}

0 commit comments

Comments
 (0)