Fix the content-type http header validation for binary format, in commons.js and unmarshaller
Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
parent
8ab8bf89f8
commit
d6032dda0d
|
@ -1,3 +1,16 @@
|
|||
const Constants = require("./constants.js");
|
||||
|
||||
function sanityContentType(contentType) {
|
||||
if(contentType) {
|
||||
return Array.of(contentType)
|
||||
.map(c => c.split(";"))
|
||||
.map(c => c.shift())
|
||||
.shift();
|
||||
}
|
||||
|
||||
return contentType;
|
||||
}
|
||||
|
||||
function sanityAndClone(headers) {
|
||||
|
||||
var sanityHeaders = {};
|
||||
|
@ -8,9 +21,13 @@ function sanityAndClone(headers) {
|
|||
sanityHeaders[header.toLowerCase()] = headers[header];
|
||||
});
|
||||
|
||||
sanityHeaders[Constants.HEADER_CONTENT_TYPE] =
|
||||
sanityContentType(sanityHeaders[Constants.HEADER_CONTENT_TYPE]);
|
||||
|
||||
return sanityHeaders;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sanityAndClone
|
||||
sanityAndClone,
|
||||
sanityContentType
|
||||
};
|
||||
|
|
|
@ -32,10 +32,7 @@ function validateArgs(payload, headers) {
|
|||
function resolveBindingName(payload, headers) {
|
||||
|
||||
var contentType =
|
||||
Array.of(headers[Constants.HEADER_CONTENT_TYPE])
|
||||
.map(c => c.split(";"))
|
||||
.map(c => c.shift())
|
||||
.shift();
|
||||
Commons.sanityContentType(headers[Constants.HEADER_CONTENT_TYPE]);
|
||||
|
||||
if(contentType.startsWith(Constants.MIME_CE)){
|
||||
// Structured
|
||||
|
|
Loading…
Reference in New Issue