Recently while writing specs for a Phoenix application, I came across this scenario, where I needed to pass a jwt token in
request-headers for authorization of Users.
I knew of a setup method where you can setup connection headers or variables to be used later in the tests. All worked fine for
one or two modules. But it felt wrong. I thought may be I could do this in a module and later use it in others, like Plugs.
Here is the module I created.
And later used it like:
And voila, I had proper authorization headers with jwt.