Skip to content

Commit

Permalink
tests: add headers content-type to snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
NexVeridian committed Dec 16, 2024
1 parent e352e88 commit dc97291
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/controller/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ async fn openapi_spec(#[case] test_name: &str) {
(
res.status().to_string(),
res.url().to_string(),
res.headers().get("content-type").unwrap().to_owned(),
res.text().await.unwrap(),
)
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
source: tests/controller/openapi.rs
expression: "(res.status().to_string(), res.url().to_string(), res.text().await.unwrap(),)"
expression: "(res.status().to_string(), res.url().to_string(),\nres.headers().get(\"content-type\").unwrap().to_owned(),\nres.text().await.unwrap(),)"
---
(
"200 OK",
"http://localhost:5555/api-docs/openapi.json",
"application/json",
"{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Loco Demo\",\"description\":\"This app is a kitchensink for various capabilities and examples of the [Loco](https://loco.rs) project.\",\"contact\":{\"name\":\"Dotan Nahum\",\"email\":\"[email protected]\"},\"license\":{\"name\":\"Apache-2.0\"},\"version\":\"0.13.2\"},\"paths\":{\"/album\":{\"get\":{\"operationId\":\"get_action_openapi\",\"responses\":{\"200\":{\"description\":\"Album found\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/Album\"}}}}}}}},\"components\":{\"schemas\":{\"Album\":{\"type\":\"object\",\"required\":[\"title\",\"rating\"],\"properties\":{\"rating\":{\"type\":\"integer\",\"format\":\"int32\",\"minimum\":0},\"title\":{\"type\":\"string\"}}}},\"securitySchemes\":{\"api_key\":{\"type\":\"apiKey\",\"in\":\"header\",\"name\":\"apikey\"},\"jwt_token\":{\"type\":\"http\",\"scheme\":\"bearer\",\"bearerFormat\":\"JWT\"}}}}",
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
source: tests/controller/openapi.rs
expression: "(res.status().to_string(), res.url().to_string(), res.text().await.unwrap(),)"
expression: "(res.status().to_string(), res.url().to_string(),\nres.headers().get(\"content-type\").unwrap().to_owned(),\nres.text().await.unwrap(),)"
---
(
"200 OK",
"http://localhost:5555/api-docs/openapi.yaml",
"application/yaml",
"openapi: 3.1.0\ninfo:\n title: Loco Demo\n description: This app is a kitchensink for various capabilities and examples of the [Loco](https://loco.rs) project.\n contact:\n name: Dotan Nahum\n email: [email protected]\n license:\n name: Apache-2.0\n version: 0.13.2\npaths:\n /album:\n get:\n operationId: get_action_openapi\n responses:\n '200':\n description: Album found\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Album'\ncomponents:\n schemas:\n Album:\n type: object\n required:\n - title\n - rating\n properties:\n rating:\n type: integer\n format: int32\n minimum: 0\n title:\n type: string\n securitySchemes:\n api_key:\n type: apiKey\n in: header\n name: apikey\n jwt_token:\n type: http\n scheme: bearer\n bearerFormat: JWT\n",
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
source: tests/controller/openapi.rs
expression: "(res.status().to_string(), res.url().to_string(), res.text().await.unwrap(),)"
expression: "(res.status().to_string(), res.url().to_string(),\nres.headers().get(\"content-type\").unwrap().to_owned(),\nres.text().await.unwrap(),)"
---
(
"200 OK",
"http://localhost:5555/redoc/openapi.json",
"application/json",
"{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Loco Demo\",\"description\":\"This app is a kitchensink for various capabilities and examples of the [Loco](https://loco.rs) project.\",\"contact\":{\"name\":\"Dotan Nahum\",\"email\":\"[email protected]\"},\"license\":{\"name\":\"Apache-2.0\"},\"version\":\"0.13.2\"},\"paths\":{\"/album\":{\"get\":{\"operationId\":\"get_action_openapi\",\"responses\":{\"200\":{\"description\":\"Album found\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/Album\"}}}}}}}},\"components\":{\"schemas\":{\"Album\":{\"type\":\"object\",\"required\":[\"title\",\"rating\"],\"properties\":{\"rating\":{\"type\":\"integer\",\"format\":\"int32\",\"minimum\":0},\"title\":{\"type\":\"string\"}}}},\"securitySchemes\":{\"api_key\":{\"type\":\"apiKey\",\"in\":\"header\",\"name\":\"apikey\"},\"jwt_token\":{\"type\":\"http\",\"scheme\":\"bearer\",\"bearerFormat\":\"JWT\"}}}}",
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
source: tests/controller/openapi.rs
expression: "(res.status().to_string(), res.url().to_string(), res.text().await.unwrap(),)"
expression: "(res.status().to_string(), res.url().to_string(),\nres.headers().get(\"content-type\").unwrap().to_owned(),\nres.text().await.unwrap(),)"
---
(
"200 OK",
"http://localhost:5555/redoc/openapi.yaml",
"application/yaml",
"openapi: 3.1.0\ninfo:\n title: Loco Demo\n description: This app is a kitchensink for various capabilities and examples of the [Loco](https://loco.rs) project.\n contact:\n name: Dotan Nahum\n email: [email protected]\n license:\n name: Apache-2.0\n version: 0.13.2\npaths:\n /album:\n get:\n operationId: get_action_openapi\n responses:\n '200':\n description: Album found\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Album'\ncomponents:\n schemas:\n Album:\n type: object\n required:\n - title\n - rating\n properties:\n rating:\n type: integer\n format: int32\n minimum: 0\n title:\n type: string\n securitySchemes:\n api_key:\n type: apiKey\n in: header\n name: apikey\n jwt_token:\n type: http\n scheme: bearer\n bearerFormat: JWT\n",
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
source: tests/controller/openapi.rs
expression: "(res.status().to_string(), res.url().to_string(), res.text().await.unwrap(),)"
expression: "(res.status().to_string(), res.url().to_string(),\nres.headers().get(\"content-type\").unwrap().to_owned(),\nres.text().await.unwrap(),)"
---
(
"200 OK",
"http://localhost:5555/scalar/openapi.json",
"application/json",
"{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Loco Demo\",\"description\":\"This app is a kitchensink for various capabilities and examples of the [Loco](https://loco.rs) project.\",\"contact\":{\"name\":\"Dotan Nahum\",\"email\":\"[email protected]\"},\"license\":{\"name\":\"Apache-2.0\"},\"version\":\"0.13.2\"},\"paths\":{\"/album\":{\"get\":{\"operationId\":\"get_action_openapi\",\"responses\":{\"200\":{\"description\":\"Album found\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/Album\"}}}}}}}},\"components\":{\"schemas\":{\"Album\":{\"type\":\"object\",\"required\":[\"title\",\"rating\"],\"properties\":{\"rating\":{\"type\":\"integer\",\"format\":\"int32\",\"minimum\":0},\"title\":{\"type\":\"string\"}}}},\"securitySchemes\":{\"api_key\":{\"type\":\"apiKey\",\"in\":\"header\",\"name\":\"apikey\"},\"jwt_token\":{\"type\":\"http\",\"scheme\":\"bearer\",\"bearerFormat\":\"JWT\"}}}}",
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---
source: tests/controller/openapi.rs
expression: "(res.status().to_string(), res.url().to_string(), res.text().await.unwrap(),)"
expression: "(res.status().to_string(), res.url().to_string(),\nres.headers().get(\"content-type\").unwrap().to_owned(),\nres.text().await.unwrap(),)"
---
(
"200 OK",
"http://localhost:5555/scalar/openapi.yaml",
"application/yaml",
"openapi: 3.1.0\ninfo:\n title: Loco Demo\n description: This app is a kitchensink for various capabilities and examples of the [Loco](https://loco.rs) project.\n contact:\n name: Dotan Nahum\n email: [email protected]\n license:\n name: Apache-2.0\n version: 0.13.2\npaths:\n /album:\n get:\n operationId: get_action_openapi\n responses:\n '200':\n description: Album found\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Album'\ncomponents:\n schemas:\n Album:\n type: object\n required:\n - title\n - rating\n properties:\n rating:\n type: integer\n format: int32\n minimum: 0\n title:\n type: string\n securitySchemes:\n api_key:\n type: apiKey\n in: header\n name: apikey\n jwt_token:\n type: http\n scheme: bearer\n bearerFormat: JWT\n",
)

0 comments on commit dc97291

Please sign in to comment.