Skip to content

Commit

Permalink
Update README example for accessing headers
Browse files Browse the repository at this point in the history
Using event.headers['Some-Header'] throws an error when the header is
not set. So it is better to use event.headers.get('Some-Header')
instead.

Signed-off-by: Mehdi Yedes <mehdi.yedes@gmail.com>
  • Loading branch information
mehyedes authored and alexellis committed Jul 24, 2020
1 parent 9fb5527 commit d4f9645
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def handle(event, context):
return {
"statusCode": 200,
"body": {
"content-type-received": event.headers['Content-Type']
"content-type-received": event.headers.get('Content-Type')
}
}
```

0 comments on commit d4f9645

Please sign in to comment.