@kiyasov/platform-hono 1.2.3 → 1.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiyasov/platform-hono",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Nest adapter for Hono",
5
5
  "author": "Islam Kiiasov",
6
6
  "repository": {
@@ -221,17 +221,20 @@ export class HonoAdapter extends AbstractHttpAdapter<
221
221
  this.instance.use(this.bodyLimit(bodyLimit), async (ctx, next) => {
222
222
  const contentType = ctx.req.header("content-type");
223
223
 
224
- if (rawBody) {
225
- (ctx.req as any).rawBody = Buffer.from(await ctx.req.text());
226
- }
227
-
228
224
  switch (type) {
229
225
  case "application/json":
230
- if (contentType?.startsWith("application/json"))
226
+ if (contentType?.startsWith("application/json")) {
227
+ if (rawBody) {
228
+ (ctx.req as any).rawBody = Buffer.from(await ctx.req.text());
229
+ }
231
230
  (ctx.req as any).body = await ctx.req.json();
231
+ }
232
232
  break;
233
233
  case "text/plain":
234
234
  if (contentType?.startsWith("text/plain")) {
235
+ if (rawBody) {
236
+ (ctx.req as any).rawBody = Buffer.from(await ctx.req.text());
237
+ }
235
238
  (ctx.req as any).body = await ctx.req.json();
236
239
  }
237
240
  break;