File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change 1
- const Constants = require ( "./constants.js" ) ;
1
+ const {
2
+ HEADER_CONTENT_TYPE ,
3
+ MIME_CE ,
4
+ MIME_CE_JSON ,
5
+ MIME_JSON ,
6
+ MIME_OCTET_STREAM
7
+ } = require ( "./constants.js" ) ;
2
8
const Commons = require ( "./commons.js" ) ;
3
9
4
10
const STRUCTURED = "structured" ;
5
11
const BINARY = "binary" ;
6
12
7
13
const allowedBinaryContentTypes = [
8
- Constants . MIME_JSON ,
9
- Constants . MIME_OCTET_STREAM
14
+ MIME_JSON ,
15
+ MIME_OCTET_STREAM
10
16
] ;
11
17
12
18
const allowedStructuredContentTypes = [
13
- Constants . MIME_CE_JSON
19
+ MIME_CE_JSON
14
20
] ;
15
21
16
22
// Is it binary or structured?
17
23
function resolveBindingName ( payload , headers ) {
18
24
const contentType =
19
- Commons . sanityContentType ( headers [ Constants . HEADER_CONTENT_TYPE ] ) ;
25
+ Commons . sanityContentType ( headers [ HEADER_CONTENT_TYPE ] ) ;
20
26
21
- if ( contentType . startsWith ( Constants . MIME_CE ) ) {
27
+ if ( contentType . startsWith ( MIME_CE ) ) {
22
28
// Structured
23
29
if ( allowedStructuredContentTypes . includes ( contentType ) ) {
24
30
return STRUCTURED ;
@@ -54,7 +60,7 @@ class Unmarshaller {
54
60
55
61
// Validation level 1
56
62
const sanityHeaders = Commons . sanityAndClone ( headers ) ;
57
- if ( ! sanityHeaders [ Constants . HEADER_CONTENT_TYPE ] ) {
63
+ if ( ! sanityHeaders [ HEADER_CONTENT_TYPE ] ) {
58
64
throw new TypeError ( "content-type header not found" ) ;
59
65
}
60
66
You can’t perform that action at this time.
0 commit comments