Skip to content
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

Made responses in Getting Started code into valid Proxy Integration r… #68

Merged
merged 2 commits into from Aug 17, 2017

Conversation

nikioftime
Copy link
Contributor

…esponses

Running through the HOWTO.md as stated, I got ERROR: Function Products returned an invalid response (must include one of: body, headers or statusCode in the response object) as a result of running curl http://localhost:3000/products, because the responses in the callback aren't valid Proxy Integration responses. This change simply puts those original responses into the body of a JSON object.

HOWTO.md Outdated
@@ -58,23 +58,23 @@ exports.handler = (event, context, callback) => {
case "GET":

if(id) {
callback(null, "This is a READ operation on product ID " + id);
callback(null, { body: "This is a READ operation on product ID " + id});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! It is generally a good practice to manually return statusCode = 200 for successful calls. Can you make that change as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course!

@sanathkr
Copy link
Contributor

Thanks for doing this!

@nikioftime
Copy link
Contributor Author

Glad I could help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants