From a6a8d8bace39b99feeb1a9708cd93658f66ae63c Mon Sep 17 00:00:00 2001 From: Shigma Date: Sun, 19 May 2024 04:06:47 +0800 Subject: [PATCH] fix(satori): transform camel case for API requests --- adapters/satori/src/bot.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/adapters/satori/src/bot.ts b/adapters/satori/src/bot.ts index 26052d8b..819c35d9 100644 --- a/adapters/satori/src/bot.ts +++ b/adapters/satori/src/bot.ts @@ -1,4 +1,4 @@ -import { Bot, Context, h, HTTP, snakeCase, Universal } from '@satorijs/core' +import { Bot, camelCase, Context, h, HTTP, snakeCase, Universal } from '@satorijs/core' export function transformKey(source: any, callback: (key: string) => string) { if (!source || typeof source !== 'object') return source @@ -53,6 +53,7 @@ for (const [key, method] of Object.entries(Universal.Methods)) { } } this.logger.debug('[request]', key, payload) - return this.http.post('/v1/' + key, payload) + const result = await this.http.post('/v1/' + key, payload) + return transformKey(result, camelCase) } }