mirror of
https://github.com/mitmproxy/mitmproxy.git
synced 2025-02-21 14:22:18 +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)
|
([#5725](https://github.com/mitmproxy/mitmproxy/pull/5725), @mhils)
|
||||||
* Add `replay.server.add` command for adding flows to server replay buffer
|
* Add `replay.server.add` command for adding flows to server replay buffer
|
||||||
([#5851](https://github.com/mitmproxy/mitmproxy/pull/5851), @italankin)
|
([#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
|
### Breaking Changes
|
||||||
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
from . import base
|
from . import base
|
||||||
from mitmproxy.utils import strutils
|
|
||||||
|
|
||||||
|
|
||||||
class ViewRaw(base.View):
|
class ViewRaw(base.View):
|
||||||
name = "Raw"
|
name = "Raw"
|
||||||
|
|
||||||
def __call__(self, data, **metadata):
|
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:
|
def render_priority(self, data: bytes, **metadata) -> float:
|
||||||
return 0.1 * float(bool(data))
|
return 0.1 * float(bool(data))
|
||||||
|
@ -5,6 +5,16 @@ from mitmproxy.contentviews import raw
|
|||||||
def test_view_raw():
|
def test_view_raw():
|
||||||
v = full_eval(raw.ViewRaw())
|
v = full_eval(raw.ViewRaw())
|
||||||
assert v(b"foo")
|
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():
|
def test_render_priority():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user