Add ability for api DELETE request to return appropriate status codes 400, 404, and 500.
Time estimated: 6 hours
Actual Time: 7 hours
Sprint Summary:
I was able to get the api call to return 404 for event not found, 400 for invalid input parameter, and 500 for Internal Server Error. To get this to work I had to enable "Use Lambda Proxy integration" in the api gateway so this should be looked more.
To handle the 400 response for invalid input I used the npm package uuid-validate.
Last, I have a working example with curl but not with a browser. If we need to enable cors I will have to find out why this isn't working even though it is enabled.
There is a bug that was just found and Zak made an issue for. I need to update the spelling of eventID to event_id in the lambda function.
CURL DEMO:
This call results in a 200 response and deletes the item (TEST ONLY ONCE):
curl -v -H "Content-Type:application/json" -X DELETE https://s0fwtr81ia.execute-api.us-east-2.amazonaws.com/v1/events/4fa76918-315c-11e9-b210-d663bd873d93
This call results in a 404 response for an item not found:
curl -v -H "Content-Type:application/json" -X DELETE https://s0fwtr81ia.execute-api.us-east-2.amazonaws.com/v1/events/57c6ba76-3469-11e9-b210-d663bd873d93
This call results in a 400 response for invalid input (not uuid version 1):
curl -v -H "Content-Type:application/json" -X DELETE https://s0fwtr81ia.execute-api.us-east-2.amazonaws.com/v1/events/4
Add ability for api DELETE request to return appropriate status codes 400, 404, and 500.
Time estimated: 6 hours Actual Time: 7 hours
Sprint Summary:
I was able to get the api call to return 404 for event not found, 400 for invalid input parameter, and 500 for Internal Server Error. To get this to work I had to enable "Use Lambda Proxy integration" in the api gateway so this should be looked more.
To handle the 400 response for invalid input I used the npm package uuid-validate.
Last, I have a working example with curl but not with a browser. If we need to enable cors I will have to find out why this isn't working even though it is enabled.
There is a bug that was just found and Zak made an issue for. I need to update the spelling of eventID to event_id in the lambda function.
CURL DEMO:
This call results in a 200 response and deletes the item (TEST ONLY ONCE):
curl -v -H "Content-Type:application/json" -X DELETE https://s0fwtr81ia.execute-api.us-east-2.amazonaws.com/v1/events/4fa76918-315c-11e9-b210-d663bd873d93
This call results in a 404 response for an item not found:
curl -v -H "Content-Type:application/json" -X DELETE https://s0fwtr81ia.execute-api.us-east-2.amazonaws.com/v1/events/57c6ba76-3469-11e9-b210-d663bd873d93
This call results in a 400 response for invalid input (not uuid version 1):
curl -v -H "Content-Type:application/json" -X DELETE https://s0fwtr81ia.execute-api.us-east-2.amazonaws.com/v1/events/4
This is the Github branch -> travis_feature/sprint3.
This is the PR
View Wiki page here