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
|
// Commons
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
CHARSET_DEFAULT : "utf-8",
|
||||||
|
|
||||||
MIME_JSON : "application/json",
|
MIME_JSON : "application/json",
|
||||||
|
MIME_CE : "application/cloudevents",
|
||||||
MIME_CE_JSON : "application/cloudevents+json",
|
MIME_CE_JSON : "application/cloudevents+json",
|
||||||
|
|
||||||
HEADER_CONTENT_TYPE : "content-type"
|
HEADER_CONTENT_TYPE : "content-type"
|
||||||
|
|
|
@ -3,8 +3,6 @@ var JSONParser = require("../../formats/json/parser.js");
|
||||||
|
|
||||||
const Constants = require("./constants.js");
|
const Constants = require("./constants.js");
|
||||||
|
|
||||||
const ce_structured_content_type = "application/cloudevents";
|
|
||||||
|
|
||||||
const structured = "structured";
|
const structured = "structured";
|
||||||
const binary = "binary";
|
const binary = "binary";
|
||||||
|
|
||||||
|
@ -37,9 +35,9 @@ function validate_args(payload, headers) {
|
||||||
function resolve_binding_name(payload, headers) {
|
function resolve_binding_name(payload, headers) {
|
||||||
|
|
||||||
var contentType = headers[Constants.HEADER_CONTENT_TYPE];
|
var contentType = headers[Constants.HEADER_CONTENT_TYPE];
|
||||||
if(contentType.startsWith(ce_structured_content_type)){
|
if(contentType.startsWith(Constants.MIME_CE)){
|
||||||
// Structured
|
// Structured
|
||||||
console.log(allowed_structured_content_types);
|
|
||||||
if(allowed_structured_content_types.includes(contentType)){
|
if(allowed_structured_content_types.includes(contentType)){
|
||||||
return structured;
|
return structured;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue