Skip to content

Handle response in AdonisJs middleware #1454

Answered by iammrsea
Agilulfo1820 asked this question in Help
Discussion options

You must be logged in to vote

I'm not sure that the 'finish' event is getting fired on the object you registered it on.
Maybe you should try debugging it like the snippet below and see what you get.

class MyMiddleware {
    async handle ({response}, next) {
        await next()
       console.log(response)
    }
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Agilulfo1820
Comment options

@thetutlage
Comment options

@Agilulfo1820
Comment options

Answer selected by RomainLanz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants