@kiyasov/platform-hono 1.4.6 → 1.5.0

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.4.6",
3
+ "version": "1.5.0",
4
4
  "description": "Nest adapter for Hono",
5
5
  "author": "Islam Kiiasov",
6
6
  "repository": {
@@ -65,6 +65,8 @@ export class HonoAdapter extends AbstractHttpAdapter<
65
65
  ctx.req['params'] = ctx.req.param();
66
66
 
67
67
  await routeHandler(ctx.req, ctx, next);
68
+
69
+ return this.getBody(ctx);
68
70
  };
69
71
  }
70
72
 
@@ -341,9 +343,11 @@ export class HonoAdapter extends AbstractHttpAdapter<
341
343
  contentType?.startsWith('application/x-www-form-urlencoded')
342
344
  ) {
343
345
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
344
- (ctx.req as any).body = await ctx.req.parseBody({
345
- all: true,
346
- });
346
+ (ctx.req as any).body = await ctx.req
347
+ .parseBody({
348
+ all: true,
349
+ })
350
+ .catch(() => {});
347
351
  } else if (
348
352
  contentType?.startsWith('application/json') ||
349
353
  contentType?.startsWith('text/plain')
@@ -353,7 +357,7 @@ export class HonoAdapter extends AbstractHttpAdapter<
353
357
  (ctx.req as any).rawBody = Buffer.from(await ctx.req.text());
354
358
  }
355
359
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
356
- (ctx.req as any).body = await ctx.req.json();
360
+ (ctx.req as any).body = await ctx.req.json().catch(() => {});
357
361
  }
358
362
 
359
363
  await next();