-
-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
responseParameters support #12
Comments
I am currently working on error API Gateway and lambda error handling and here is my use case: "responses": {
"default": {
"statusCode": "200",
"responseParameters": {},
"responseModels": {},
"responseTemplates": {
"application/json": ""
}
},
".*\"statusCode\":404.*": {
"statusCode": "404",
"responseParameters": {},
"responseModels": {},
"responseTemplates": {
"application/json": "#set($inputRoot = $input.path('$.errorMessage'))\n$inputRoot"
}
}
} handler.js context.fail(JSON.stringify({"statusCode":404,"error":"Not Found"})); The above example works on AWS. Not sure if this on your roadmap but it would be nice if offline plugin could match regular expression and return 404 statusCode with errorMessage (currently is returning 200). This is nice article about API Gateway error handling. |
@spardo spardo Using (request and response) parameters is hard because it really has to do with integrations, but I'll try something. @martinmicunda You can teak you template to make it work with Offline: "404": {
"statusCode": "404",
"selectionPattern": ".*\"statusCode\":404.*",
"responseParameters": {},
"responseModels": {},
"responseTemplates": {
"application/json": "#set($inputRoot = $input.path('$.errorMessage'))\n$inputRoot"
}
} But I'll commit something to make it work with your code soon. |
@martinmicunda Solved in v1.2.2. @spardo It seems like a long road, but request and response parameters are on their way 😅 |
I am starting to have same request like @spardo :) I try to set up response content-type to json (offline currently return conte-type as text) so it would be nice to have this feature in the offline plugin :) "responseParameters": {
"method.response.header.Content-Type": "'application/json; charset=UTF-8'"
} |
Content-type returned as text is a bug! I'll fix it! |
thanks... |
I don't see the response content-type set as text, in which case do you have this ? |
Anyway, I worked a fix, v1.2.6, please review it, thanks. |
sorry .. The
|
With v1.2.6 ? |
just pulled latest version and it works ... thanks ;) |
Sweet! I'll start working on request/responseParameters right away. Won't be before friday I think. EDIT: @spardo @martinmicunda Only responseParameters for starters, because for requestParameters I need to hijack Hapijs's request, I'll do that later. |
@spardo @martinmicunda So it seems that only header modification is supported by APIG's responseParameters when it comes to lambda integrations. 1.3.0 is on it's way, will support Also, the current doc is ugly and confusing so I'll work on that. |
@spardo @martinmicunda Done. run |
Thank you very much and sorry for going dark, I was not receiving any email notifications. Can't wait to test it out. |
Would like support for responseParameters.
Not sure if the example below is valid but would like to dynamically load responses to the header, such as
location
for a newly created item.The text was updated successfully, but these errors were encountered: