When defining the type of an url parameter in a flask endpoint the routing to this endpoint based on the type is not performed correctly anymore.
In the following setup also requests without the fitting parameter type are routed to the url:
Endpoint:
@api_blueprint.route("/enpoint_route/<int:id>", methods=['POST'])
Unittest:
response = client.post(
'/enpoint_route/1123a',
headers={'Accept': 'application/json',
"Content-Type": "application/json",
"},
)
self.assertEqual(response.status_code, 404) # release 2.2.0: AssertionError: 200 != 404
Since release 2.2.0 when sending a parameter which is not an int the returned status code is 200 instead of 404.
In a very short testing the issue seems to be related to the int type. Testing with float worked as expected.
Environment:
- Python version: 3.9
- Werkzeug version: 2.2.0
- Flask version: 2.1.2
When defining the type of an url parameter in a flask endpoint the routing to this endpoint based on the type is not performed correctly anymore.
In the following setup also requests without the fitting parameter type are routed to the url:
Endpoint:
@api_blueprint.route("/enpoint_route/<int:id>", methods=['POST'])Unittest:
Since release 2.2.0 when sending a parameter which is not an int the returned status code is 200 instead of 404.
In a very short testing the issue seems to be related to the int type. Testing with float worked as expected.
Environment: