{"action":"created","comment":{"url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/comments/244643504","pull_request_review_id":188563556,"id":244643504,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0NDY0MzUwNA==","diff_hunk":"@@ -21,50 +23,99 @@ use crate::{\n     strmap::StrMap,\n };\n \n-/// Representation of an API Gateway proxy event data\n+/// Internal representation of an Lambda http event from both\n+/// both ALB and API Gateway proxy event perspectives\n #[doc(hidden)]\n #[derive(Deserialize, Debug, Default)]\n #[serde(rename_all = \"camelCase\")]\n-pub(crate) struct GatewayRequest<'a> {\n+pub(crate) struct LambdaRequest<'a> {\n     pub(crate) path: Cow<'a, str>,\n     #[serde(deserialize_with = \"deserialize_method\")]\n     pub(crate) http_method: Method,\n     #[serde(deserialize_with = \"deserialize_headers\")]\n     pub(crate) headers: HeaderMap<HeaderValue>,\n+    /// For alb events these are only present when\n+    /// the `lambda.multi_value_headers.enabled` target group setting turned on\n     #[serde(default, deserialize_with = \"deserialize_multi_value_headers\")]\n     pub(crate) multi_value_headers: HeaderMap<HeaderValue>,\n     #[serde(deserialize_with = \"nullable_default\")]\n     pub(crate) query_string_parameters: StrMap,\n+    /// For alb events these are only present when\n+    /// the `lambda.multi_value_headers.enabled` target group setting turned on\n     #[serde(default, deserialize_with = \"nullable_default\")]\n     pub(crate) multi_value_query_string_parameters: StrMap,\n-    #[serde(deserialize_with = \"nullable_default\")]\n+    /// alb events do not have path parameters\n+    #[serde(default, deserialize_with = \"nullable_default\")]","path":"lambda-http/src/request.rs","position":41,"original_position":41,"commit_id":"d5cdf29590f5e1249148c3cf102e8110e8b336dc","original_commit_id":"748918dba28137cf8f31a5e64bdca3e566abd5ce","user":{"login":"davidbarsky","id":2067774,"node_id":"MDQ6VXNlcjIwNjc3NzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/2067774?v=4","gravatar_id":"","url":"https://api.github.com/users/davidbarsky","html_url":"https://github.com/davidbarsky","followers_url":"https://api.github.com/users/davidbarsky/followers","following_url":"https://api.github.com/users/davidbarsky/following{/other_user}","gists_url":"https://api.github.com/users/davidbarsky/gists{/gist_id}","starred_url":"https://api.github.com/users/davidbarsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidbarsky/subscriptions","organizations_url":"https://api.github.com/users/davidbarsky/orgs","repos_url":"https://api.github.com/users/davidbarsky/repos","events_url":"https://api.github.com/users/davidbarsky/events{/privacy}","received_events_url":"https://api.github.com/users/davidbarsky/received_events","type":"User","site_admin":false},"body":"> Will fix. Note: this is a internal crate so its more like doc for maintainers than it is for users\r\n\r\nFair point!","created_at":"2019-01-01T17:40:10Z","updated_at":"2019-01-01T17:40:10Z","html_url":"https://github.com/awslabs/aws-lambda-rust-runtime/pull/64#discussion_r244643504","pull_request_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/comments/244643504"},"html":{"href":"https://github.com/awslabs/aws-lambda-rust-runtime/pull/64#discussion_r244643504"},"pull_request":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64"}},"in_reply_to_id":244512852},"pull_request":{"url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64","id":241262139,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQxMjYyMTM5","html_url":"https://github.com/awslabs/aws-lambda-rust-runtime/pull/64","diff_url":"https://github.com/awslabs/aws-lambda-rust-runtime/pull/64.diff","patch_url":"https://github.com/awslabs/aws-lambda-rust-runtime/pull/64.patch","issue_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/issues/64","number":64,"state":"open","locked":false,"title":"support both apigw and alb events as http::{Request,Response}","user":{"login":"softprops","id":2242,"node_id":"MDQ6VXNlcjIyNDI=","avatar_url":"https://avatars3.githubusercontent.com/u/2242?v=4","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"body":"*Issue #, if available:*\r\n\r\n*Description of changes:*\r\n\r\nThis is a follow up to some commentary from the initial lambda-http pull about supporting alb events.  Below are some notes and some potential changes I considered\r\n\r\nThere's a great series of posts I lifted my knowledge of the differences between the two ( there are a few ) [here](https://serverless-training.com/articles/api-gateway-vs-application-load-balancer-technical-details/). I'd give that a quick read before looking at this.\r\n\r\nThere is one case where knowledge needs transfered about the request in order to serialize the response for alb requests`statusDescription`. \r\n\r\nstage variables and path parameters are features specific to apigateway so these request ext methods will be empty for alb requests ( have some thoughts about this below ). \r\n\r\nthe request context is uber rich for api gateway but slim for alb. Im supporting both as an enumeration but not sure about this as a design choice ( have some thoughts on this below )\r\n\r\nas a user of lambda I want the flexibility to switch between both alb and api gateway with minimal fuss. as a general goal here, if lambdas tag line is \"write code without thinking about servers\" I want this crate to represent \"write (correct) http code without thinking about the inconsistencies between http lambda triggers \". I have some ideas for potential amendments made to choices made in this pull. \r\n\r\nOne may argue that is awkward to to work with the request_context if you know your application will always be triggered by an alb or always by an api gateway. Similarly it may feel awkward to have stage_variables and path_parameters as available methods in an alb only context. One possible solution is to amend some of these choices with cargo feature flags, One for apigw support and one for alb support. When provided in combination you get the interfaces in this pull. When provided separately you get just the features specific to that type of http event.\r\n\r\n@davidbarsky let me know what you think. \r\n\r\n\r\nBy submitting this pull request\r\n\r\n- [X] I confirm that my contribution is made under the terms of the Apache 2.0 license.\r\n- [X] I confirm that I've made a best effort attempt to update all relevant documentation.\r\n","created_at":"2018-12-28T04:20:59Z","updated_at":"2019-01-01T17:40:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8575b96c67a72f3b6498ce1d86b3b39749f29a19","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64/commits","review_comments_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64/comments","review_comment_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/comments{/number}","comments_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/issues/64/comments","statuses_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/statuses/d5cdf29590f5e1249148c3cf102e8110e8b336dc","head":{"label":"softprops:http-alb","ref":"http-alb","sha":"d5cdf29590f5e1249148c3cf102e8110e8b336dc","user":{"login":"softprops","id":2242,"node_id":"MDQ6VXNlcjIyNDI=","avatar_url":"https://avatars3.githubusercontent.com/u/2242?v=4","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"repo":{"id":159789852,"node_id":"MDEwOlJlcG9zaXRvcnkxNTk3ODk4NTI=","name":"aws-lambda-rust-runtime","full_name":"softprops/aws-lambda-rust-runtime","private":false,"owner":{"login":"softprops","id":2242,"node_id":"MDQ6VXNlcjIyNDI=","avatar_url":"https://avatars3.githubusercontent.com/u/2242?v=4","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"html_url":"https://github.com/softprops/aws-lambda-rust-runtime","description":"A Rust runtime for AWS Lambda","fork":true,"url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime","forks_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/forks","keys_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/teams","hooks_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/hooks","issue_events_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/issues/events{/number}","events_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/events","assignees_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/assignees{/user}","branches_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/branches{/branch}","tags_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/tags","blobs_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/languages","stargazers_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/stargazers","contributors_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/contributors","subscribers_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/subscribers","subscription_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/subscription","commits_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/contents/{+path}","compare_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/merges","archive_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/downloads","issues_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/issues{/number}","pulls_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/labels{/name}","releases_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/releases{/id}","deployments_url":"https://api.github.com/repos/softprops/aws-lambda-rust-runtime/deployments","created_at":"2018-11-30T08:08:42Z","updated_at":"2018-12-27T11:04:00Z","pushed_at":"2018-12-30T09:58:09Z","git_url":"git://github.com/softprops/aws-lambda-rust-runtime.git","ssh_url":"git@github.com:softprops/aws-lambda-rust-runtime.git","clone_url":"https://github.com/softprops/aws-lambda-rust-runtime.git","svn_url":"https://github.com/softprops/aws-lambda-rust-runtime","homepage":"","size":174,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"awslabs:master","ref":"master","sha":"9966ee3b639af30c7bfd4ae6ad62082aa85d0fec","user":{"login":"awslabs","id":3299148,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyOTkxNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/3299148?v=4","gravatar_id":"","url":"https://api.github.com/users/awslabs","html_url":"https://github.com/awslabs","followers_url":"https://api.github.com/users/awslabs/followers","following_url":"https://api.github.com/users/awslabs/following{/other_user}","gists_url":"https://api.github.com/users/awslabs/gists{/gist_id}","starred_url":"https://api.github.com/users/awslabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awslabs/subscriptions","organizations_url":"https://api.github.com/users/awslabs/orgs","repos_url":"https://api.github.com/users/awslabs/repos","events_url":"https://api.github.com/users/awslabs/events{/privacy}","received_events_url":"https://api.github.com/users/awslabs/received_events","type":"Organization","site_admin":false},"repo":{"id":156752158,"node_id":"MDEwOlJlcG9zaXRvcnkxNTY3NTIxNTg=","name":"aws-lambda-rust-runtime","full_name":"awslabs/aws-lambda-rust-runtime","private":false,"owner":{"login":"awslabs","id":3299148,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyOTkxNDg=","avatar_url":"https://avatars0.githubusercontent.com/u/3299148?v=4","gravatar_id":"","url":"https://api.github.com/users/awslabs","html_url":"https://github.com/awslabs","followers_url":"https://api.github.com/users/awslabs/followers","following_url":"https://api.github.com/users/awslabs/following{/other_user}","gists_url":"https://api.github.com/users/awslabs/gists{/gist_id}","starred_url":"https://api.github.com/users/awslabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awslabs/subscriptions","organizations_url":"https://api.github.com/users/awslabs/orgs","repos_url":"https://api.github.com/users/awslabs/repos","events_url":"https://api.github.com/users/awslabs/events{/privacy}","received_events_url":"https://api.github.com/users/awslabs/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/awslabs/aws-lambda-rust-runtime","description":"A Rust runtime for AWS Lambda","fork":false,"url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime","forks_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/forks","keys_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/keys{/key_id}","collaborators_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/teams","hooks_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/hooks","issue_events_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/issues/events{/number}","events_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/events","assignees_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/assignees{/user}","branches_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/branches{/branch}","tags_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/tags","blobs_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/git/refs{/sha}","trees_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/git/trees{/sha}","statuses_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/statuses/{sha}","languages_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/languages","stargazers_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/stargazers","contributors_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/contributors","subscribers_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/subscribers","subscription_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/subscription","commits_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/commits{/sha}","git_commits_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/git/commits{/sha}","comments_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/comments{/number}","issue_comment_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/issues/comments{/number}","contents_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/contents/{+path}","compare_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/compare/{base}...{head}","merges_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/merges","archive_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/downloads","issues_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/issues{/number}","pulls_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls{/number}","milestones_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/milestones{/number}","notifications_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/labels{/name}","releases_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/releases{/id}","deployments_url":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/deployments","created_at":"2018-11-08T18:36:53Z","updated_at":"2019-01-01T16:11:09Z","pushed_at":"2019-01-01T16:01:56Z","git_url":"git://github.com/awslabs/aws-lambda-rust-runtime.git","ssh_url":"git@github.com:awslabs/aws-lambda-rust-runtime.git","clone_url":"https://github.com/awslabs/aws-lambda-rust-runtime.git","svn_url":"https://github.com/awslabs/aws-lambda-rust-runtime","homepage":"","size":200,"stargazers_count":581,"watchers_count":581,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":27,"open_issues":19,"watchers":581,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64"},"html":{"href":"https://github.com/awslabs/aws-lambda-rust-runtime/pull/64"},"issue":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/issues/64"},"comments":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/issues/64/comments"},"review_comments":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64/comments"},"review_comment":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/pulls/64/commits"},"statuses":{"href":"https://api.github.com/repos/awslabs/aws-lambda-rust-runtime/statuses/d5cdf29590f5e1249148c3cf102e8110e8b336dc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"davidbarsky"}}