Skip to content

Commit

Permalink
Add jwt headers in JsonClient if exist
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia committed Sep 13, 2023
1 parent a80e4d6 commit b8860dc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils_flask_sqla/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@ def open(self, *args, **kwargs):
}
)
)
# the set_logged_user_jwt add a jwt attribute to client with the current logged user
jwt = getattr(self, "jwt")
if jwt:
jwt_headers = Headers({"Authorization": f"Bearer {jwt}"})
headers.extend(jwt_headers)

kwargs["headers"] = headers
return super().open(*args, **kwargs)

0 comments on commit b8860dc

Please sign in to comment.