![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
lambda-proxy-response
Advanced tools
A wrap around response for aws lambda integration proxy
npm install lambda-proxy-response --save
response
methodconst lambdaProxy = require('lambda-proxy-reponse');
exports.handler = (event, context, callback) => {
// response method needs at least 3 parameters
// statusCode, headers, body
const response = lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData' });
// -> response = {
// statusCodes: 200,
// headers: {'X-header': 'Your headers value'},
// body: '{ "bodyData": "yourBodyData" }'
// }
callback(null, response);
// OR you can pass the callback to the `response` method and it will be called automatically
// The above implementation equal to
lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData' }, callback);
};
lambdaProxy.ok = lambdaProxy.response(200, ...)
lambdaProxy.created = lambdaProxy.response(201, ...)
lambdaProxy.badRequest = lambdaProxy.response(400, ...)
lambdaProxy.unAuthorized = lambdaProxy.response(401, ...)
lambdaProxy.forbidden = lambdaProxy.response(403, ...)
lambdaProxy.notFound = lambdaProxy.response(404, ...)
lambdaProxy.serverError = lambdaProxy.response(500, ...)
From version 2.0, new config option has been introduced to set default values for response.
Default body for every response. Will be overriden if you support new body in the call
// ....
lambdaProxy.config({ body: { bodyData: 'yourDefaultBodyData' } });
// ......
let response = lambdaProxy.response(200, { 'X-header': 'Your headers value' });
// -> response = {
// statusCodes: 200,
// headers: {'X-header': 'Your headers value'},
// body: '{ "bodyData": "yourDefaultBodyData" }'
// }
response = lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData' });
// -> response = {
// statusCodes: 200,
// headers: {'X-header': 'Your headers value'},
// body: '{ "bodyData": "yourBodyData" }'
// }
Default headers for every response. By default, it will extend whatever headers you provide inside
your response. Can be turned off by setting extendHeader
in options.
// ....
lambdaProxy.config({ header: { 'X-Default-Header': 'Your default header' } });
// ......
let response = lambdaProxy.response(200, null, { bodyData: 'yourBodyData' });
// -> response = {
// statusCodes: 200,
// headers: { 'X-Default-Header': 'Your default header' },
// body: '{ "bodyData": "yourBodyData" }'
// }
// by default it will extend your header
response = lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData' });
// -> response = {
// statusCodes: 200,
// headers: { 'X-header': 'Your headers value', 'X-Default-Header': 'Your default header' },
// body: '{ "bodyData": "yourBodyData" }'
// }
// you can turn it off by setting config
lambdaProxy.config({ header: { 'X-Default-Header': 'Your default header' }, extendHeader: false });
// .......
response = lambdaProxy.response(200, { 'X-header': 'Your headers value' }, { 'bodyData': 'yourBodyData' });
// -> response = {
// statusCodes: 200,
// headers: { 'X-header': 'Your headers value' },
// body: '{ "bodyData": "yourBodyData" }'
// }
Default status code.
// ....
lambdaProxy.config({ status: 200 });
// ....
response = lambdaProxy.response();
// -> response = {
// statusCodes: 200,
// headers: {},
// body: '{}'
// }
This response template is only for used with newly aws lambda proxy integration.
You can read more about it here
FAQs
A wrap around response for lambda proxy integration
The npm package lambda-proxy-response receives a total of 40 weekly downloads. As such, lambda-proxy-response popularity was classified as not popular.
We found that lambda-proxy-response demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.