File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change
1
+ const Constants = require ( "./constants.js" ) ;
2
+
3
+ function sanityContentType ( contentType ) {
4
+ if ( contentType ) {
5
+ return Array . of ( contentType )
6
+ . map ( c => c . split ( ";" ) )
7
+ . map ( c => c . shift ( ) )
8
+ . shift ( ) ;
9
+ }
10
+
11
+ return contentType ;
12
+ }
13
+
1
14
function sanityAndClone ( headers ) {
2
15
3
16
var sanityHeaders = { } ;
@@ -8,9 +21,13 @@ function sanityAndClone(headers) {
8
21
sanityHeaders [ header . toLowerCase ( ) ] = headers [ header ] ;
9
22
} ) ;
10
23
24
+ sanityHeaders [ Constants . HEADER_CONTENT_TYPE ] =
25
+ sanityContentType ( sanityHeaders [ Constants . HEADER_CONTENT_TYPE ] ) ;
26
+
11
27
return sanityHeaders ;
12
28
}
13
29
14
30
module . exports = {
15
- sanityAndClone
31
+ sanityAndClone,
32
+ sanityContentType
16
33
} ;
Original file line number Diff line number Diff line change @@ -32,10 +32,7 @@ function validateArgs(payload, headers) {
32
32
function resolveBindingName ( payload , headers ) {
33
33
34
34
var contentType =
35
- Array . of ( headers [ Constants . HEADER_CONTENT_TYPE ] )
36
- . map ( c => c . split ( ";" ) )
37
- . map ( c => c . shift ( ) )
38
- . shift ( ) ;
35
+ Commons . sanityContentType ( headers [ Constants . HEADER_CONTENT_TYPE ] ) ;
39
36
40
37
if ( contentType . startsWith ( Constants . MIME_CE ) ) {
41
38
// Structured
You can’t perform that action at this time.
0 commit comments