diff --git a/lib/bindings/http/constants.js b/lib/bindings/http/constants.js index 7be8dfc..fea4a2a 100644 --- a/lib/bindings/http/constants.js +++ b/lib/bindings/http/constants.js @@ -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" diff --git a/lib/bindings/http/unmarshaller_0_2.js b/lib/bindings/http/unmarshaller_0_2.js index 49fc02f..10b00fe 100644 --- a/lib/bindings/http/unmarshaller_0_2.js +++ b/lib/bindings/http/unmarshaller_0_2.js @@ -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 {