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.
The intent of decorator design pattern, as described in
Design Patterns by the Gang of Four is to
attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality.