Skip to content

Commit

Permalink
Tweak HTTP sample comments (#628)
Browse files Browse the repository at this point in the history
* Change HTTP sample comments

* Fix typo

* Add busboy comment

* Tweak busboy comment
  • Loading branch information
Ace Nassri authored Jul 23, 2018
1 parent d615ac8 commit 349b4b7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions functions/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
/**
* Responds to any HTTP request that can provide a "message" field in the body.
*
* @param {Object} req Cloud Function request context.
* @param {Object} res Cloud Function response context.
* @param {Object} req ExpressJS object containing the received HTTP request.
* @param {Object} res ExpressJS object containing the HTTP response to send.
*/
exports.helloWorld = (req, res) => {
if (req.body.message === undefined) {
// This is an error case, as "message" is required
res.status(400).send('No message defined!');
} else {
// Everything is ok
// Everything is ok - call request-terminating method to signal function
// completion. (Otherwise, the function may continue to run until timeout.)
console.log(req.body.message);
res.status(200).end();
}
Expand Down Expand Up @@ -142,6 +143,9 @@ exports.parseXML = (req, res) => {
const path = require('path');
const os = require('os');
const fs = require('fs');

// Node.js doesn't have a built-in multipart/form-data parsing library.
// Instead, we can use the 'busboy' library from NPM to parse these requests.
const Busboy = require('busboy');

exports.uploadFile = (req, res) => {
Expand Down

0 comments on commit 349b4b7

Please sign in to comment.