@nmtjs/protocol 0.15.0-beta.45 → 0.15.0-beta.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/utils.js +4 -4
- package/dist/server/utils.js.map +1 -1
- package/package.json +9 -9
- package/src/server/utils.ts +5 -5
package/dist/server/utils.js
CHANGED
|
@@ -5,12 +5,12 @@ export class UnsupportedContentTypeError extends UnsupportedFormatError {
|
|
|
5
5
|
export class UnsupportedAcceptTypeError extends UnsupportedFormatError {
|
|
6
6
|
}
|
|
7
7
|
export const getFormat = (format, { accept, contentType }) => {
|
|
8
|
-
const encoder =
|
|
8
|
+
const encoder = accept ? format.supportsEncoder(accept) : undefined;
|
|
9
9
|
if (!encoder)
|
|
10
|
-
throw new UnsupportedContentTypeError('Unsupported Content type');
|
|
11
|
-
const decoder = accept ? format.supportsDecoder(accept) : undefined;
|
|
12
|
-
if (!decoder)
|
|
13
10
|
throw new UnsupportedAcceptTypeError('Unsupported Accept type');
|
|
11
|
+
const decoder = contentType ? format.supportsDecoder(contentType) : undefined;
|
|
12
|
+
if (!decoder)
|
|
13
|
+
throw new UnsupportedContentTypeError('Unsupported Content type');
|
|
14
14
|
return { encoder, decoder };
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=utils.js.map
|
package/dist/server/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/server/utils.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;CAAG;AAEpD,MAAM,OAAO,2BAA4B,SAAQ,sBAAsB;CAAG;AAE1E,MAAM,OAAO,0BAA2B,SAAQ,sBAAsB;CAAG;AAEzE,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAuB,EACvB,EAAE,MAAM,EAAE,WAAW,EAAuB,EAC5C,EAAE,CAAC;IACH,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/server/utils.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;CAAG;AAEpD,MAAM,OAAO,2BAA4B,SAAQ,sBAAsB;CAAG;AAE1E,MAAM,OAAO,0BAA2B,SAAQ,sBAAsB;CAAG;AAEzE,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAuB,EACvB,EAAE,MAAM,EAAE,WAAW,EAAuB,EAC5C,EAAE,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACnE,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,0BAA0B,CAAC,yBAAyB,CAAC,CAAA;IAE7E,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7E,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,2BAA2B,CAAC,0BAA0B,CAAC,CAAA;IAEnE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAAA,CAC5B,CAAA"}
|
package/package.json
CHANGED
|
@@ -21,18 +21,18 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"hookable": "6.0.0-rc.1",
|
|
24
|
-
"@nmtjs/common": "0.15.0-beta.
|
|
25
|
-
"@nmtjs/type": "0.15.0-beta.
|
|
26
|
-
"@nmtjs/contract": "0.15.0-beta.
|
|
24
|
+
"@nmtjs/common": "0.15.0-beta.47",
|
|
25
|
+
"@nmtjs/type": "0.15.0-beta.47",
|
|
26
|
+
"@nmtjs/contract": "0.15.0-beta.47"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@nmtjs/core": "0.15.0-beta.
|
|
29
|
+
"@nmtjs/core": "0.15.0-beta.47"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@nmtjs/common": "0.15.0-beta.
|
|
33
|
-
"@nmtjs/
|
|
34
|
-
"@nmtjs/type": "0.15.0-beta.
|
|
35
|
-
"@nmtjs/
|
|
32
|
+
"@nmtjs/common": "0.15.0-beta.47",
|
|
33
|
+
"@nmtjs/contract": "0.15.0-beta.47",
|
|
34
|
+
"@nmtjs/type": "0.15.0-beta.47",
|
|
35
|
+
"@nmtjs/core": "0.15.0-beta.47"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"LICENSE.md",
|
|
41
41
|
"README.md"
|
|
42
42
|
],
|
|
43
|
-
"version": "0.15.0-beta.
|
|
43
|
+
"version": "0.15.0-beta.47",
|
|
44
44
|
"scripts": {
|
|
45
45
|
"clean-build": "rm -rf ./dist"
|
|
46
46
|
}
|
package/src/server/utils.ts
CHANGED
|
@@ -11,12 +11,12 @@ export const getFormat = (
|
|
|
11
11
|
format: ProtocolFormats,
|
|
12
12
|
{ accept, contentType }: ResolveFormatParams,
|
|
13
13
|
) => {
|
|
14
|
-
const encoder =
|
|
15
|
-
if (!encoder)
|
|
16
|
-
throw new UnsupportedContentTypeError('Unsupported Content type')
|
|
14
|
+
const encoder = accept ? format.supportsEncoder(accept) : undefined
|
|
15
|
+
if (!encoder) throw new UnsupportedAcceptTypeError('Unsupported Accept type')
|
|
17
16
|
|
|
18
|
-
const decoder =
|
|
19
|
-
if (!decoder)
|
|
17
|
+
const decoder = contentType ? format.supportsDecoder(contentType) : undefined
|
|
18
|
+
if (!decoder)
|
|
19
|
+
throw new UnsupportedContentTypeError('Unsupported Content type')
|
|
20
20
|
|
|
21
21
|
return { encoder, decoder }
|
|
22
22
|
}
|