New contants + usage

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-06-11 12:37:49 -03:00
parent 7839b733d6
commit 6de756d102
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,9 @@
// Commons
module.exports = {
CHARSET_DEFAULT : "utf-8",
MIME_JSON : "application/json",
MIME_CE : "application/cloudevents",
MIME_CE_JSON : "application/cloudevents+json",
HEADER_CONTENT_TYPE : "content-type"

View File

@ -3,8 +3,6 @@ var JSONParser = require("../../formats/json/parser.js");
const Constants = require("./constants.js");
const ce_structured_content_type = "application/cloudevents";
const structured = "structured";
const binary = "binary";
@ -37,9 +35,9 @@ function validate_args(payload, headers) {
function resolve_binding_name(payload, headers) {
var contentType = headers[Constants.HEADER_CONTENT_TYPE];
if(contentType.startsWith(ce_structured_content_type)){
if(contentType.startsWith(Constants.MIME_CE)){
// Structured
console.log(allowed_structured_content_types);
if(allowed_structured_content_types.includes(contentType)){
return structured;
} else {