File tree 3 files changed +7
-12
lines changed
3 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,6 @@ def test_post_json(self) -> None:
72
72
res = self ._testapp ().post_json ("/foo" , {"bar" : "baz" }, status = 200 )
73
73
self .assertEqual (res .json , {"bar" : "zab" })
74
74
75
- # FIXME: Something deep in request validation isn't happy right now.
76
- # Might be related: https://github.com/Pylons/pyramid_openapi3/issues/199
77
- @unittest .expectedFailure
78
75
def test_post_form (self ) -> None : # pragma: no cover
79
76
"""Post with `application/x-www-form-urlencoded`."""
80
77
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ def test_relative_app_request() -> None:
72
72
assert openapi_request .path == "/subpath/foo"
73
73
assert openapi_request .path_pattern == "/foo"
74
74
assert openapi_request .method == "get"
75
- assert openapi_request .body == ""
75
+ assert openapi_request .body == b ""
76
76
assert openapi_request .mimetype == "text/html"
77
77
assert openapi_request .content_type == "text/html"
78
78
@@ -114,7 +114,7 @@ def test_mapped_values_response() -> None:
114
114
115
115
openapi_response = PyramidOpenAPIResponse (pyramid_request .response )
116
116
117
- assert openapi_response .data == ""
117
+ assert openapi_response .data == b ""
118
118
assert openapi_response .status_code == 200
119
119
assert openapi_response .mimetype == "text/html"
120
120
assert openapi_response .content_type == "text/html"
Original file line number Diff line number Diff line change @@ -47,12 +47,10 @@ def method(self) -> str:
47
47
return self .request .method .lower ()
48
48
49
49
@property
50
- def body (self ) -> t .Optional [t .Union [str , t .Dict ]]:
51
- """The request body, as string .""" # noqa D401
50
+ def body (self ) -> t .Optional [t .Union [bytes , str , t .Dict ]]:
51
+ """The request body.""" # noqa D401
52
52
if "multipart/form-data" == self .request .content_type :
53
53
return self .request .POST .mixed ()
54
- if isinstance (self .request .body , bytes ):
55
- return self .request .body .decode ("utf-8" )
56
54
return self .request .body
57
55
58
56
@property
@@ -71,9 +69,9 @@ def __init__(self, response: Response) -> None:
71
69
self .response = response
72
70
73
71
@property
74
- def data (self ) -> str :
75
- """The response body, as string .""" # noqa D401
76
- return self .response .text
72
+ def data (self ) -> bytes :
73
+ """The response body.""" # noqa D401
74
+ return self .response .body
77
75
78
76
@property
79
77
def status_code (self ) -> int :
You can’t perform that action at this time.
0 commit comments