New contants + usage
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
7839b733d6
commit
6de756d102
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue