INNER CODE UNIT · Rust

preserves_request_parts_and_body_variants

poem-web/poem · poem-lambda/src/lib.rs:131

    async fn preserves_request_parts_and_body_variants() {
        for (body, expected) in [
            (LambdaBody::Empty, Vec::new()),
            (
                LambdaBody::Text("hello 世界".into()),
                "hello 世界".as_bytes().to_vec(),
            ),
            (LambdaBody::Binary(vec![0, 159, 255]), vec![0, 159, 255]),
        ] {
            let req = poem::http::Request::builder()
                .method(Method::POST)
                .uri("https://example.com/hello?name=world")
                .version(Version::HTTP_11)
                .header("x-example", "preserved")
                .extension(String::from("request extension"))
                .body(body)
                .unwrap();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…