-
Notifications
You must be signed in to change notification settings - Fork 679
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly handle aiohttp requests in Sentry reporting (#5681)
* Correctly handle aiohttp requests The request header seems to be a dictionary in current Sentry SDK. The previous code actually failed with an exception when trying to unpack the header. However, it seems that Exceptions are not handled or printed in this filter function, so those issues were simply swallowed. The new code has been tested to correctly sanitize and report issues during aiohttp requests. * Fix pytests
- Loading branch information
Showing
3 changed files
with
124 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,22 @@ | ||
"""Test supervisor.utils.sanitize_url.""" | ||
|
||
from supervisor.misc.filter import sanitize_url | ||
from supervisor.misc.filter import sanitize_host, sanitize_url | ||
|
||
|
||
def test_sanitize_host(): | ||
"""Test supervisor.utils.sanitize_host.""" | ||
assert sanitize_host("my.duckdns.org") == "sanitized-host.invalid" | ||
|
||
|
||
def test_sanitize_url(): | ||
"""Test supervisor.utils.sanitize_url.""" | ||
assert sanitize_url("test") == "test" | ||
assert sanitize_url("http://my.duckdns.org") == "http://example.com" | ||
assert sanitize_url("http://my.duckdns.org/test") == "http://example.com/test" | ||
assert sanitize_url("http://my.duckdns.org") == "http://sanitized-host.invalid" | ||
assert ( | ||
sanitize_url("http://my.duckdns.org/test") | ||
== "http://sanitized-host.invalid/test" | ||
) | ||
assert ( | ||
sanitize_url("http://my.duckdns.org/test?test=123") | ||
== "http://sanitized-host.invalid/test?test=123" | ||
) |