Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix test example in Readme
Types are private and cannot be used. Also the handler is async. We have to `await` the result.
  • Loading branch information
johan-smits authored Aug 2, 2022
commit b0e8699f9ab470e1dd294ea041c9083eacfe2181
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ your text fixtures into the structures, and call your handler directly:
#[test]
fn test_my_lambda_handler() {
let input = serde_json::from_str("{\"command\": \"Say Hi!\"}").expect("failed to parse event");
let context = lambda_runtime::types::Context::default();
let context = lambda_runtime::Context::default();

let event = lambda_runtime::types::LambdaEvent::new(input, context);
let event = lambda_runtime::LambdaEvent::new(input, context);

my_lambda_handler(event).expect("failed to handle event");
my_lambda_handler(event).await.expect("failed to handle event");
}
```

Expand All @@ -316,7 +316,7 @@ fn test_my_lambda_handler() {
let request = lambda_http::request::from_str(input)
.expect("failed to create request");

let response = my_lambda_handler(request).expect("failed to handle request");
let response = my_lambda_handler(request).await.expect("failed to handle request");
}
```

Expand Down