Skip to content

Commit

Permalink
typings: fix mock plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 15, 2022
1 parent 3e932af commit 0368272
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions plugins/mock/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class MessageClient {
session.content = content
this.app.emit(session as any, 'before-send', session)
this.replies.push(content)
return []
}
const dispose = this.app.on('middleware', (session) => {
if (session.id === uuid) process.nextTick(_resolve)
Expand Down
5 changes: 3 additions & 2 deletions plugins/mock/src/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ export class Webhook {
body += chunk
return true
}
res.end = (chunk: any) => {
res.write(chunk)
res.end = (callback: () => void) => {
const code = res.statusCode
const headers = res.getHeaders()
resolve({ code, body, headers })
callback?.()
return res
}
this.app._httpServer.emit('request', req, res)
req.emit('data', body)
Expand Down

0 comments on commit 0368272

Please sign in to comment.