diff --git a/srcpkgs/python3-httpbin/patches/werkzeug-2.1.patch b/srcpkgs/python3-httpbin/patches/werkzeug-2.1.patch new file mode 100644 index 00000000000..4ac566edbf0 --- /dev/null +++ b/srcpkgs/python3-httpbin/patches/werkzeug-2.1.patch @@ -0,0 +1,61 @@ +From df733e90032589861d93be78e22dbafc2f1dbea4 Mon Sep 17 00:00:00 2001 +From: Danil Shein +Date: Mon, 26 Sep 2022 15:26:00 +0300 +Subject: [PATCH] fix Werkzeug 2.1.x compatibility + +- fix httpbin/core.py: use Responce class instead of BaseResponse +see: https://github.com/pallets/werkzeug/pull/2276 +- fix tests: TestClient doesn't provide 'Content-Length' header anymore +see: https://github.com/pallets/werkzeug/issues/2347 +--- + httpbin/core.py | 7 +++++-- + test_httpbin.py | 4 ++-- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/httpbin/core.py b/httpbin/core.py +index 305c9882..d5c89eed 100644 +--- a/httpbin/core.py ++++ b/httpbin/core.py +@@ -29,7 +29,10 @@ + from six.moves import range as xrange + from werkzeug.datastructures import WWWAuthenticate, MultiDict + from werkzeug.http import http_date +-from werkzeug.wrappers import BaseResponse ++try: ++ from werkzeug.wrappers import Response ++except ImportError: ++ from werkzeug.wrappers import BaseResponse as Response + from werkzeug.http import parse_authorization_header + from flasgger import Swagger, NO_SANITIZER + +@@ -77,7 +80,7 @@ def jsonify(*args, **kwargs): + + + # Prevent WSGI from correcting the casing of the Location header +-BaseResponse.autocorrect_location_header = False ++Response.autocorrect_location_header = False + + # Find the correct template folder when running from a different location + tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates") +diff --git a/test_httpbin.py b/test_httpbin.py +index b7104ffc..87305ae6 100755 +--- a/test_httpbin.py ++++ b/test_httpbin.py +@@ -148,7 +148,7 @@ def test_get(self): + data = json.loads(response.data.decode('utf-8')) + self.assertEqual(data['args'], {}) + self.assertEqual(data['headers']['Host'], 'localhost') +- self.assertEqual(data['headers']['Content-Length'], '0') ++ # self.assertEqual(data['headers']['Content-Length'], '0') + self.assertEqual(data['headers']['User-Agent'], 'test') + # self.assertEqual(data['origin'], None) + self.assertEqual(data['url'], 'http://localhost/get') +@@ -162,7 +162,7 @@ def test_anything(self): + data = json.loads(response.data.decode('utf-8')) + self.assertEqual(data['args'], {}) + self.assertEqual(data['headers']['Host'], 'localhost') +- self.assertEqual(data['headers']['Content-Length'], '0') ++ # self.assertEqual(data['headers']['Content-Length'], '0') + self.assertEqual(data['url'], 'http://localhost/anything/foo/bar') + self.assertEqual(data['method'], 'GET') + self.assertTrue(response.data.endswith(b'\n')) diff --git a/srcpkgs/python3-httpbin/template b/srcpkgs/python3-httpbin/template index c9de30cb2f2..ad08cf13f9b 100644 --- a/srcpkgs/python3-httpbin/template +++ b/srcpkgs/python3-httpbin/template @@ -1,7 +1,7 @@ # Template file for 'python3-httpbin' pkgname=python3-httpbin version=0.7.0 -revision=2 +revision=3 build_style=python3-module hostmakedepends="python3-setuptools" depends="python3-Flask python3-decorator python3-six python3-Brotli