mirror of
https://github.com/mitmproxy/mitmproxy.git
synced 2025-02-20 05:43:35 +00:00
Removed escaping string to get real raw view (#5894)
* Removed escaping string to get real raw view * [autofix.ci] apply automated fixes * Updated changelog * extend tests --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Maximilian Hils <git@maximilianhils.com>
This commit is contained in:
parent
0c4549f4cc
commit
849a3c33cb
@ -9,6 +9,8 @@
|
||||
([#5725](https://github.com/mitmproxy/mitmproxy/pull/5725), @mhils)
|
||||
* Add `replay.server.add` command for adding flows to server replay buffer
|
||||
([#5851](https://github.com/mitmproxy/mitmproxy/pull/5851), @italankin)
|
||||
* Removed string escaping in raw view.
|
||||
([#5470](https://github.com/mitmproxy/mitmproxy/issues/5470), @stephenspol)
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
from . import base
|
||||
from mitmproxy.utils import strutils
|
||||
|
||||
|
||||
class ViewRaw(base.View):
|
||||
name = "Raw"
|
||||
|
||||
def __call__(self, data, **metadata):
|
||||
return "Raw", base.format_text(strutils.bytes_to_escaped_str(data, True))
|
||||
return "Raw", base.format_text(data)
|
||||
|
||||
def render_priority(self, data: bytes, **metadata) -> float:
|
||||
return 0.1 * float(bool(data))
|
||||
|
@ -5,6 +5,16 @@ from mitmproxy.contentviews import raw
|
||||
def test_view_raw():
|
||||
v = full_eval(raw.ViewRaw())
|
||||
assert v(b"foo")
|
||||
# unicode
|
||||
assert v("🫠".encode()) == (
|
||||
"Raw",
|
||||
[[("text", "🫠".encode())]],
|
||||
)
|
||||
# invalid utf8
|
||||
assert v(b"\xFF") == (
|
||||
"Raw",
|
||||
[[("text", b"\xFF")]],
|
||||
)
|
||||
|
||||
|
||||
def test_render_priority():
|
||||
|
Loading…
x
Reference in New Issue
Block a user