-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#319 - created the success handler response
- Loading branch information
1 parent
0ab24aa
commit cc8cc06
Showing
4 changed files
with
34 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { parseResponseToAWSGatewayPattern } from '../parse-response-to-aws-gateway'; | ||
|
||
/** | ||
* Create a base response object that can be used in the send respons method | ||
* @public | ||
* @memberof Response | ||
* @function create | ||
* @param {Object} [body] - value to json.stringify | ||
* @param {Object} [headers] - headers to set on the response | ||
* @param {Number} headers.maxAge - cache control max-age in seconds | ||
* @param {Number} [statusCode] - http status code | ||
* @param {String} [requestId] - AWS request id | ||
* @returns {Object} the value set to the header | ||
*/ | ||
function handlerSuccess({ body, headers, statusCode }, requestId) { | ||
return parseResponseToAWSGatewayPattern({ | ||
body: { data: body, requestId }, | ||
headers, | ||
statusCode, | ||
}); | ||
} | ||
|
||
export { handlerSuccess }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters