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" ) ;
28const Commons = require ( "./commons.js" ) ;
39
410const STRUCTURED = "structured" ;
511const BINARY = "binary" ;
612
713const allowedBinaryContentTypes = [
8- Constants . MIME_JSON ,
9- Constants . MIME_OCTET_STREAM
14+ MIME_JSON ,
15+ MIME_OCTET_STREAM
1016] ;
1117
1218const allowedStructuredContentTypes = [
13- Constants . MIME_CE_JSON
19+ MIME_CE_JSON
1420] ;
1521
1622// Is it binary or structured?
1723function resolveBindingName ( payload , headers ) {
1824 const contentType =
19- Commons . sanityContentType ( headers [ Constants . HEADER_CONTENT_TYPE ] ) ;
25+ Commons . sanityContentType ( headers [ HEADER_CONTENT_TYPE ] ) ;
2026
21- if ( contentType . startsWith ( Constants . MIME_CE ) ) {
27+ if ( contentType . startsWith ( MIME_CE ) ) {
2228 // Structured
2329 if ( allowedStructuredContentTypes . includes ( contentType ) ) {
2430 return STRUCTURED ;
@@ -54,7 +60,7 @@ class Unmarshaller {
5460
5561 // Validation level 1
5662 const sanityHeaders = Commons . sanityAndClone ( headers ) ;
57- if ( ! sanityHeaders [ Constants . HEADER_CONTENT_TYPE ] ) {
63+ if ( ! sanityHeaders [ HEADER_CONTENT_TYPE ] ) {
5864 throw new TypeError ( "content-type header not found" ) ;
5965 }
6066
You can’t perform that action at this time.
0 commit comments