Skip to content

Commit

Permalink
fix(lark): transform web stream to node stream (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikoTan authored Apr 4, 2024
1 parent 350472a commit 1453fc9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions adapters/lark/src/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import internal from 'stream'
import { Readable } from 'node:stream'
import { ReadableStream } from 'node:stream/web'
import { Adapter, Context, Logger, Schema } from '@satorijs/satori'
import {} from '@cordisjs/server'

Expand Down Expand Up @@ -85,15 +86,15 @@ export class HttpServer<C extends Context = Context> extends Adapter<C, FeishuBo
const bot = this.bots.find((bot) => bot.selfId === selfId)
if (!bot) return ctx.status = 404

const resp = await bot.http<internal.Readable>(`/im/v1/messages/${messageId}/resources/${key}`, {
const resp = await bot.http<ReadableStream>(`/im/v1/messages/${messageId}/resources/${key}`, {
method: 'GET',
params: { type },
responseType: 'stream',
})

ctx.status = 200
ctx.response.headers['Content-Type'] = resp.headers.get('content-type')
ctx.response.body = resp.data
ctx.response.body = Readable.fromWeb(resp.data)
})
}

Expand Down

0 comments on commit 1453fc9

Please sign in to comment.