Skip to content

Commit f610fda

Browse files
committed
chore: update to openapi-core 0.19.0
Not all tests pass, see following commits. Signed-off-by: Mike Fiedler <[email protected]>
1 parent b0c39b2 commit f610fda

File tree

6 files changed

+26
-45
lines changed

6 files changed

+26
-45
lines changed

poetry.lock

Lines changed: 7 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exclude = ["pyramid_openapi3/tests/"]
2626
[tool.poetry.dependencies]
2727
python = "^3.8"
2828

29-
openapi-core = "~0.18.0"
29+
openapi-core = ">=0.19.0"
3030
pyramid = ">=1.10.7"
3131

3232

pyramid_openapi3/tests/test_extract_errors.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,10 @@ def test_lists(self) -> None:
480480

481481
assert res.json == [
482482
{
483-
"exception": "ValidationError",
484-
"message": "'not a number' is not of type 'number'",
485-
"field": "foo/0/bam",
483+
"exception": "RequestBodyValidationError",
484+
"message": "Failed to cast value to number type: not a number",
485+
# TODO: field is no longer emitted for the request body
486+
# "field": "foo/0/bam",
486487
}
487488
]
488489

pyramid_openapi3/tests/test_validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ def test_request_validation_error_causes_response_validation_error(self) -> None
398398
router = Router(self.config.registry)
399399
environ = {
400400
"wsgi.url_scheme": "http",
401+
"SERVER_PROTOCOL": "HTTP/1.1",
401402
"SERVER_NAME": "localhost",
402403
"SERVER_PORT": "8080",
403404
"REQUEST_METHOD": "GET",

pyramid_openapi3/tests/test_wrappers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def test_mapped_values_request() -> None:
4343
assert openapi_request.method == "get"
4444
assert openapi_request.body == ""
4545
assert openapi_request.mimetype == "text/html"
46+
assert openapi_request.content_type == "text/html"
4647

4748

4849
def test_relative_app_request() -> None:
@@ -73,6 +74,7 @@ def test_relative_app_request() -> None:
7374
assert openapi_request.method == "get"
7475
assert openapi_request.body == ""
7576
assert openapi_request.mimetype == "text/html"
77+
assert openapi_request.content_type == "text/html"
7678

7779

7880
def test_form_data_request() -> None:
@@ -115,4 +117,5 @@ def test_mapped_values_response() -> None:
115117
assert openapi_response.data == ""
116118
assert openapi_response.status_code == 200
117119
assert openapi_response.mimetype == "text/html"
120+
assert openapi_response.content_type == "text/html"
118121
assert openapi_response.headers == pyramid_request.response.headers

pyramid_openapi3/wrappers.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def body(self) -> t.Optional[t.Union[str, t.Dict]]:
5555
return self.request.body.decode("utf-8")
5656
return self.request.body
5757

58+
@property
59+
def content_type(self) -> str:
60+
"""The content type of the request.""" # noqa D401
61+
return self.request.content_type
62+
5863
@property
5964
def mimetype(self) -> str:
6065
"""The content type of the request.""" # noqa D401
@@ -75,6 +80,11 @@ def status_code(self) -> int:
7580
"""The status code as integer.""" # noqa D401
7681
return self.response.status_code
7782

83+
@property
84+
def content_type(self) -> str:
85+
"""The content type of the response.""" # noqa D401
86+
return self.response.content_type
87+
7888
@property
7989
def mimetype(self) -> str:
8090
"""The content type of the response.""" # noqa D401

0 commit comments

Comments
 (0)