Skip to content

Commit 71565d6

Browse files
authored
Fix test example in Readme (#507)
Types are private and cannot be used. Also the handler is async. We have to `await` the result.
1 parent 336e552 commit 71565d6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ your text fixtures into the structures, and call your handler directly:
297297
#[test]
298298
fn test_my_lambda_handler() {
299299
let input = serde_json::from_str("{\"command\": \"Say Hi!\"}").expect("failed to parse event");
300-
let context = lambda_runtime::types::Context::default();
300+
let context = lambda_runtime::Context::default();
301301
302-
let event = lambda_runtime::types::LambdaEvent::new(input, context);
302+
let event = lambda_runtime::LambdaEvent::new(input, context);
303303
304-
my_lambda_handler(event).expect("failed to handle event");
304+
my_lambda_handler(event).await.expect("failed to handle event");
305305
}
306306
```
307307

@@ -316,7 +316,7 @@ fn test_my_lambda_handler() {
316316
let request = lambda_http::request::from_str(input)
317317
.expect("failed to create request");
318318
319-
let response = my_lambda_handler(request).expect("failed to handle request");
319+
let response = my_lambda_handler(request).await.expect("failed to handle request");
320320
}
321321
```
322322

0 commit comments

Comments
 (0)