Using the commons
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
c37b31fc3b
commit
733476f4a1
|
@ -1,4 +1,5 @@
|
|||
const Constants = require("./constants.js");
|
||||
const Commons = require("./commons.js");
|
||||
const Cloudevent = require("../../cloudevent.js");
|
||||
const Spec02 = require("../../specs/spec_0_2.js");
|
||||
|
||||
|
@ -51,16 +52,6 @@ function validate_args(payload, attributes) {
|
|||
}
|
||||
}
|
||||
|
||||
function sanity(headers) {
|
||||
var sanity_headers = JSON.parse(JSON.stringify(headers));
|
||||
|
||||
for(header in sanity_headers){
|
||||
sanity_headers[header.toLowerCase()] = sanity_headers[header];
|
||||
}
|
||||
|
||||
return sanity_headers;
|
||||
}
|
||||
|
||||
function Receiver(configuration) {
|
||||
|
||||
}
|
||||
|
@ -70,7 +61,7 @@ Receiver.prototype.check = function(payload, headers) {
|
|||
validate_args(payload, headers);
|
||||
|
||||
// Clone and low case all headers names
|
||||
var sanity_headers = sanity(headers);
|
||||
var sanity_headers = Commons.sanity_and_clone(headers);
|
||||
|
||||
// Validation Level 1
|
||||
if(!allowed_content_types
|
||||
|
@ -98,7 +89,7 @@ Receiver.prototype.parse = function(payload, headers) {
|
|||
this.check(payload, headers);
|
||||
|
||||
// Clone and low case all headers names
|
||||
var sanity_headers = sanity(headers);
|
||||
var sanity_headers = Commons.sanity_and_clone(headers);
|
||||
|
||||
var cloudevent = new Cloudevent(Spec02);
|
||||
for(header in setter_reflections) {
|
||||
|
|
Loading…
Reference in New Issue