MCPcopy Create free account
hub / github.com/aws/aws-lambda-rust-runtime / json_into_response

Function json_into_response

lambda-http/src/response.rs:437–450  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

435
436 #[tokio::test]
437 async fn json_into_response() {
438 let response = json!({ "hello": "lambda"}).into_response().await;
439 match response.body() {
440 Body::Text(json) => assert_eq!(json, r#"{"hello":"lambda"}"#),
441 _ => panic!("invalid body"),
442 }
443 assert_eq!(
444 response
445 .headers()
446 .get(CONTENT_TYPE)
447 .map(|h| h.to_str().expect("invalid header")),
448 Some("application/json")
449 )
450 }
451
452 #[tokio::test]
453 async fn text_into_response() {

Callers

nothing calls this directly

Calls 1

into_responseMethod · 0.45

Tested by

no test coverage detected