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

fix: Make functions_http_method consistent with other samples #1376

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions functions/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ exports.helloContent = (req, res) => {
// [END functions_http_content]

// [START functions_http_method]
function handleGET(req, res) {
// Do something with the GET request
res.status(200).send('Hello World!');
}

function handlePUT(req, res) {
// Do something with the PUT request
res.status(403).send('Forbidden!');
}

/**
* Responds to a GET request with "Hello World!". Forbids a PUT request.
*
Expand All @@ -77,10 +67,10 @@ function handlePUT(req, res) {
exports.helloHttp = (req, res) => {
switch (req.method) {
case 'GET':
handleGET(req, res);
res.status(200).send('Hello World!');
break;
case 'PUT':
handlePUT(req, res);
res.status(403).send('Forbidden!');
break;
default:
res.status(405).send({error: 'Something blew up!'});
Expand Down