Skip to content

Commit

Permalink
Merge pull request #1 from railsware/add-user-agent
Browse files Browse the repository at this point in the history
Add User-Agent header
  • Loading branch information
andrii-porokhnavets authored May 5, 2023
2 parents a48614b + 1883267 commit 9af3c71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mailtrap/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def headers(self) -> Dict[str, str]:
return {
"Authorization": f"Bearer {self.token}",
"Content-Type": "application/json",
"User-Agent": (
"mailtrap-python (https://github.com/railsware/mailtrap-python)"
),
}

@staticmethod
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def test_headers_should_return_appropriate_dict(self) -> None:
assert client.headers == {
"Authorization": "Bearer fake_token",
"Content-Type": "application/json",
"User-Agent": (
"mailtrap-python (https://github.com/railsware/mailtrap-python)"
),
}

@responses.activate
Expand Down

0 comments on commit 9af3c71

Please sign in to comment.