@twin.org/api-server-fastify 0.0.1-next.29 → 0.0.1-next.30
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/cjs/index.cjs +9 -8
- package/dist/esm/index.mjs +9 -8
- package/docs/changelog.md +1 -1
- package/package.json +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -137,14 +137,15 @@ class FastifyWebServer {
|
|
|
137
137
|
}
|
|
138
138
|
if (core.Is.arrayValue(this._mimeTypeProcessors)) {
|
|
139
139
|
for (const contentTypeHandler of this._mimeTypeProcessors) {
|
|
140
|
-
this._fastify.addContentTypeParser(contentTypeHandler.getTypes(), { parseAs: "buffer" },
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
done(
|
|
147
|
-
|
|
140
|
+
this._fastify.addContentTypeParser(contentTypeHandler.getTypes(), { parseAs: "buffer" }, (request, body, done) => {
|
|
141
|
+
// Fastify does not handle this method correctly if it is async
|
|
142
|
+
// so we have to use the callback method
|
|
143
|
+
contentTypeHandler
|
|
144
|
+
.handle(body)
|
|
145
|
+
// eslint-disable-next-line promise/prefer-await-to-then, promise/no-callback-in-promise
|
|
146
|
+
.then(processed => done(null, processed))
|
|
147
|
+
// eslint-disable-next-line promise/prefer-await-to-then, promise/no-callback-in-promise
|
|
148
|
+
.catch(err => done(core.BaseError.fromError(err)));
|
|
148
149
|
});
|
|
149
150
|
}
|
|
150
151
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -135,14 +135,15 @@ class FastifyWebServer {
|
|
|
135
135
|
}
|
|
136
136
|
if (Is.arrayValue(this._mimeTypeProcessors)) {
|
|
137
137
|
for (const contentTypeHandler of this._mimeTypeProcessors) {
|
|
138
|
-
this._fastify.addContentTypeParser(contentTypeHandler.getTypes(), { parseAs: "buffer" },
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
done(
|
|
145
|
-
|
|
138
|
+
this._fastify.addContentTypeParser(contentTypeHandler.getTypes(), { parseAs: "buffer" }, (request, body, done) => {
|
|
139
|
+
// Fastify does not handle this method correctly if it is async
|
|
140
|
+
// so we have to use the callback method
|
|
141
|
+
contentTypeHandler
|
|
142
|
+
.handle(body)
|
|
143
|
+
// eslint-disable-next-line promise/prefer-await-to-then, promise/no-callback-in-promise
|
|
144
|
+
.then(processed => done(null, processed))
|
|
145
|
+
// eslint-disable-next-line promise/prefer-await-to-then, promise/no-callback-in-promise
|
|
146
|
+
.catch(err => done(BaseError.fromError(err)));
|
|
146
147
|
});
|
|
147
148
|
}
|
|
148
149
|
}
|
package/docs/changelog.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/api-server-fastify",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.30",
|
|
4
4
|
"description": "Use Fastify as the core web server for APIs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@fastify/compress": "8.0.1",
|
|
18
18
|
"@fastify/cors": "10.0.2",
|
|
19
|
-
"@twin.org/api-core": "0.0.1-next.
|
|
20
|
-
"@twin.org/api-models": "0.0.1-next.
|
|
19
|
+
"@twin.org/api-core": "0.0.1-next.30",
|
|
20
|
+
"@twin.org/api-models": "0.0.1-next.30",
|
|
21
21
|
"@twin.org/core": "next",
|
|
22
22
|
"@twin.org/logging-models": "next",
|
|
23
23
|
"@twin.org/nameof": "next",
|