Skip to content

Commit

Permalink
fix(satori): transform camel case for API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed May 18, 2024
1 parent c248b89 commit a6a8d8b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions adapters/satori/src/bot.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
}
}

0 comments on commit a6a8d8b

Please sign in to comment.