-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Description
The file http/index.js in the node template has confusing JSDoc and function signature.
This is the relevant part of the JSDoc:
/**
* @param {Context} context a context object.
* @param {object} context.body the request body if any
* @param {object} context.query the query string deserialized as an object, if any
* @param {object} context.log logging object with methods for 'info', 'warn', 'error', etc.
* @param {object} context.headers the HTTP request headers
* @param {string} context.method the HTTP request method
* @param {string} context.httpVersion the HTTP protocol version
* See: https://github.com/knative/func/blob/main/docs/function-developers/nodejs.md#the-context-object
*/The function signature is this:
const handle = async (context, body) => {Based on the JSDoc one would assume that the function has only one parameter (of type Context). But the function signature specifies two parameters.
If body is property of the object context why would you specify it as a separate parameter?
Also the JSDoc is missing @returns tag:
* @returns {object} HTTP response object with body, query, or error statusMetadata
Metadata
Assignees
Labels
No labels