diff --git a/debian/changelog b/debian/changelog index 0b871fb2a4b3ae4535b939801cfb792699c9fcb9..238e72a378a5151993e243ea32cc901eceb639b6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python3-sams-classes (1.0.2) unstable; urgency=medium + + * fixed issue #27 "Proxy muss alle HTTP-Methoden unterstützen" + + -- Lobinger <slobinger@justus.zib.de> Mon, 19 Jun 2017 16:42:21 +0200 + python3-sams-classes (1.0.1) unstable; urgency=medium * fixed issue #20 "Basis-Pfad (/) bei API über Proxy nicht aufrufbar" diff --git a/sams_classes/sams_app.py b/sams_classes/sams_app.py index bbbfc0eda90f1f896f7770a4019271ac6e7edd0d..28e2767f542a0e2743f2469daec43a19f6f4db6b 100644 --- a/sams_classes/sams_app.py +++ b/sams_classes/sams_app.py @@ -57,11 +57,15 @@ class SAMSApp: self.__blueprint.add_url_rule( rule = self._generate_url(urlPart = proxy.urlRule), endpoint = self.__blueprint.name.replace('.', '_') + '_proxy_' + str(i), - view_func = proxy.proxy) + view_func = proxy.proxy, + methods = ['GET', 'POST', 'DELETE', 'UPDATE','PATCH', 'OPTIONS', 'PUT', + 'HEAD']) self.__blueprint.add_url_rule( rule = self._generate_url(urlPart = proxy.rootUrlRule), endpoint = self.__blueprint.name.replace('.', '_') + '_proxy_' + str(i), - view_func = proxy.proxy) + view_func = proxy.proxy, + methods = ['GET', 'POST', 'DELETE', 'UPDATE','PATCH', 'OPTIONS', 'PUT', + 'HEAD']) i += 1 @staticmethod diff --git a/sams_classes/version.py b/sams_classes/version.py index 75977e6f4181a04517451d1fdb63b6b847c1a7bf..34c1db36a1731d4c38e5d0388cafcd3d8c5a0c8b 100644 --- a/sams_classes/version.py +++ b/sams_classes/version.py @@ -1 +1 @@ -__version__ = '1.0.0' \ No newline at end of file +__version__ = '1.0.2' \ No newline at end of file diff --git a/test/test_sams_app.py b/test/test_sams_app.py index d49a68ed39c55eb570e26fb82ffdb48d73c06352..93edd4c60f37a241c533dbf26805cab6fcf966c1 100644 --- a/test/test_sams_app.py +++ b/test/test_sams_app.py @@ -239,12 +239,20 @@ class TestSAMSAppWithThreadedApi(unittest.TestCase): } ) self.flaskApp.register_blueprint(testApp.blueprint) - self.assertGreater(len(list(self.flaskApp.url_map.iter_rules())), 1) + thApp = FlaskInThread(self.flaskApp, host="localhost", port=5000) + thApp.start() + time.sleep(0.01) + with self.subTest('test flask url_map'): + self.assertGreater(len(list(self.flaskApp.url_map.iter_rules())), 1) for path in ('/api/hello', '/api/'): - with self.subTest(path): - with self.flaskApp.test_client(self) as client: - response = client.get(path) + for method in ( 'GET', 'POST', 'DELETE', 'UPDATE', 'PATCH', 'OPTIONS', + 'PUT', 'HEAD'): + with self.subTest('test path ' + path + ' method ' + method): + response = requests.request(method = method, + url = 'http://localhost:5000' + path) self.assertIs(response.status_code, 200) + requests.get('http://localhost:5000/shutdown') + if __name__ == '__main__': unittest.main() \ No newline at end of file