{"action":"created","issue":{"url":"https://api.github.com/repos/dherault/serverless-offline/issues/104","repository_url":"https://api.github.com/repos/dherault/serverless-offline","labels_url":"https://api.github.com/repos/dherault/serverless-offline/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/dherault/serverless-offline/issues/104/comments","events_url":"https://api.github.com/repos/dherault/serverless-offline/issues/104/events","html_url":"https://github.com/dherault/serverless-offline/issues/104","id":177218319,"number":104,"title":"Testing for selectionPattern regex","user":{"login":"tolbahadi","id":653088,"avatar_url":"https://avatars.githubusercontent.com/u/653088?v=3","gravatar_id":"","url":"https://api.github.com/users/tolbahadi","html_url":"https://github.com/tolbahadi","followers_url":"https://api.github.com/users/tolbahadi/followers","following_url":"https://api.github.com/users/tolbahadi/following{/other_user}","gists_url":"https://api.github.com/users/tolbahadi/gists{/gist_id}","starred_url":"https://api.github.com/users/tolbahadi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tolbahadi/subscriptions","organizations_url":"https://api.github.com/users/tolbahadi/orgs","repos_url":"https://api.github.com/users/tolbahadi/repos","events_url":"https://api.github.com/users/tolbahadi/events{/privacy}","received_events_url":"https://api.github.com/users/tolbahadi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-15T16:03:57Z","updated_at":"2016-09-16T15:07:51Z","closed_at":null,"body":"I noticed serverless offline only tests for `selectionPattern` if lambda responds with an error https://github.com/dherault/serverless-offline/blob/d1ef7e26e3041e54acc76d216e41174208c7a04d/src/index.js#L474\r\n\r\nIs this intentional? Is this how api-gateway does it? Because there are cases where lambda might want to return a non-error status code other than the default 200. For example: 30* or 20*.\r\n\r\nAlso in the case of error handling, I noticed sls-offline [only takes the error message from the response and ignores other attributes attached to the error](https://github.com/dherault/serverless-offline/blob/d1ef7e26e3041e54acc76d216e41174208c7a04d/src/index.js#L463). This prevents lambda from returning additional headers with the error which might useful.\r\n\r\nExample (this works fine with api-gateway, but not with sls-offline):\r\n\r\n```\r\n  responseTempate: {\r\n    500: {\r\n      selectionPatter: \"Error.*\",\r\n     responseParameters: {\r\n         \"method.response.header.RequestKey\": \"integration.response.body.requestKey\"\r\n      }\r\n```\r\n\r\nI was able to fix this locally by doing:\r\n\r\n```\r\nresult = Object.assign({}, error, {\r\n   errorMessage,\r\n   errorType:  err.constructor.name,\r\n   stackTrace: this._getArrayStackTrace(err.stack),\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/dherault/serverless-offline/issues/comments/247625338","html_url":"https://github.com/dherault/serverless-offline/issues/104#issuecomment-247625338","issue_url":"https://api.github.com/repos/dherault/serverless-offline/issues/104","id":247625338,"user":{"login":"dherault","id":4154003,"avatar_url":"https://avatars.githubusercontent.com/u/4154003?v=3","gravatar_id":"","url":"https://api.github.com/users/dherault","html_url":"https://github.com/dherault","followers_url":"https://api.github.com/users/dherault/followers","following_url":"https://api.github.com/users/dherault/following{/other_user}","gists_url":"https://api.github.com/users/dherault/gists{/gist_id}","starred_url":"https://api.github.com/users/dherault/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dherault/subscriptions","organizations_url":"https://api.github.com/users/dherault/orgs","repos_url":"https://api.github.com/users/dherault/repos","events_url":"https://api.github.com/users/dherault/events{/privacy}","received_events_url":"https://api.github.com/users/dherault/received_events","type":"User","site_admin":false},"created_at":"2016-09-16T15:07:50Z","updated_at":"2016-09-16T15:07:50Z","body":"Hi @tolbahadi , thanks for this issue.\r\nYour fix is good, you'll find it in the next version.\r\nI don't know if `selectionPattern` should be used without an error. @Bilal-S @minibikini Do you know the truth?"}}
{"actor":{"display_login":"dherault"}}