-
Notifications
You must be signed in to change notification settings - Fork 64
Closed
Milestone
Description
Broken:
exports.handler = async (context, event, callback) => {
const response = new Twilio.Response();
response.appendHeader('Content-Type', 'application/json; charset=UTF-8');
response.setStatusCode(400);
response.setBody(
{message: 'I am a JSON message'}
)
return callback(null, response);
};Working:
exports.handler = async (context, event, callback) => {
const response = new Twilio.Response();
response.appendHeader('Content-Type', 'application/json');
response.setStatusCode(400);
response.setBody(
{message: 'I am a JSON message'}
)
return callback(null, response);
};Instead we should adjust the check for the Content-Type header to validate that it includes application/json as opposed to being explicitly application-json.
serverless-toolkit/packages/runtime-handler/src/dev-runtime/internal/response.ts
Line 139 in 33ca348
| this.headers['Content-Type'] === 'application/json' |
Metadata
Metadata
Assignees
Labels
No labels