diff --git a/.gitignore b/.gitignore index cfe0ce19..b18d4e30 100644 --- a/.gitignore +++ b/.gitignore @@ -358,3 +358,11 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ + +# Restler bin +restler_bin/ +Compile/ +Fuzz/ +Test/ +demo_server/coverage_stats.txt +restler \ No newline at end of file diff --git a/README.md b/README.md index 72e91cff..58891274 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,9 @@ See [Testing](./docs/user-guide/Testing.md). To use custom test engine settings, **Warning:** This type of fuzzing is more aggressive and may create outages in the service under test if the service is poorly implemented (e.g., fuzzing might create resource leaks, perf degradation, backend corruptions, etc.). See [Fuzzing](./docs/user-guide/Fuzzing.md). +### With warning messages +If you are fuzzing a Flask server and want to have warnings included, use `demo_server/demo_server/wrapper.py` to start the demo server instead of just using `demo_server/demo_server/app.py`. + ## Quick Start For a quick intro with simple examples, see this [Tutorial](./docs/user-guide/TutorialDemoServer.md). diff --git a/commands.txt b/commands.txt new file mode 100644 index 00000000..b283f2ca --- /dev/null +++ b/commands.txt @@ -0,0 +1,15 @@ +# comments for macos +# compile restler +python3 ./build-restler.py --dest_dir restler_bin/ +# compile the engine seperately due to a bug +python3 ./build-restler.py --dest_dir restler_bin/ --compile_type engine --python_path /usr/local/bin/python3.8 + +# use the engine only +python3 restler.py --restler_grammar /Users/anne/Desktop/restler_project/restler-fuzzer/Compile/grammar.py --no_ssl + +# compile grammar +dotnet ./restler_bin/restler/Restler.dll compile --api_spec ./demo_server/swagger.json +# test +dotnet ./restler_bin/restler/Restler.dll test --grammar_file ./Compile/grammar.py --dictionary_file ./Compile/dict.json --settings ./Compile/engine_settings.json --no_ssl +# fuzz +dotnet ./restler_bin/restler/Restler.dll fuzz --grammar_file ./Compile/grammar.py --dictionary_file ./Compile/dict.json --settings ./Compile/engine_settings.json --no_ssl diff --git a/demo_server/Dockerfile b/demo_server/Dockerfile index 5510131e..e5f9ffed 100644 --- a/demo_server/Dockerfile +++ b/demo_server/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /app RUN pip install -r requirements.txt -EXPOSE 8888 +EXPOSE 8878 ENV FLASK_RUN_HOST=0.0.0.0 diff --git a/demo_server/README.md b/demo_server/README.md index a1a0531c..016b4b25 100644 --- a/demo_server/README.md +++ b/demo_server/README.md @@ -29,13 +29,17 @@ Start demo server at one teminal -------------------------------- `python demo_server/app.py` +Start demo server which captures warnings at one teminal +-------------------------------- +`python demo_server/wrapper.py` + - Make sure you execute all the above from the base directory of demo_server (the same directory where this README lives in.) Swagger ================== - The interactive swagger specification interface will be available at - http://localhost:8888/api/ using your browser. + http://localhost:8878/api/ using your browser. - The swagger can also be found in the demo_server directory as swagger.json - The swagger was automatically generated by flask-restplus - This swagger can be compiled and tested using RESTler. diff --git a/demo_server/db.sqlite b/demo_server/db.sqlite new file mode 100644 index 00000000..e69de29b diff --git a/demo_server/demo_server/api/blog/business.py b/demo_server/demo_server/api/blog/business.py index 2db73283..10f6a8d7 100644 --- a/demo_server/demo_server/api/blog/business.py +++ b/demo_server/demo_server/api/blog/business.py @@ -1,10 +1,13 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. +from logging import warning from demo_server.database.models import Post, Category, db from flask import abort from flask import request +import pandas as pd import json +import warnings def get_query(): # Gets the query string from the request @@ -34,13 +37,26 @@ def get_post(postId): # PLANTED_BUG - # Intentionally ignore unexpected query, so the invalid dynamic # object checker throws a bug due to '200' response. - + # PLANTED_BUG for demo purpose + check_use_exist_posts() post = Post.query.filter(Post.id == postId).one_or_none() return post or abort(404) +def check_use_exist_posts(): + exist_posts = Post.query.limit(5).all() + df = pd.DataFrame() + rows = [] + for post in exist_posts: + rows.append([post.id,post.body]) + rows.append(['7',"hello"]) + df = pd.DataFrame(rows,columns=['id','body']) + df[df['body'] == 'la']['id'] = 10 + return + def create_blog_post(): body = request.json.get('body') post = Post(body) + db.session.add(post) db.session.commit() return post diff --git a/demo_server/demo_server/api/blog/endpoints/posts.py b/demo_server/demo_server/api/blog/endpoints/posts.py index e8cabfce..73d6e922 100644 --- a/demo_server/demo_server/api/blog/endpoints/posts.py +++ b/demo_server/demo_server/api/blog/endpoints/posts.py @@ -11,7 +11,6 @@ from demo_server.api.blog.parsers import pagination_arguments from demo_server.api.restplus import api from demo_server.database.models import Post - log = logging.getLogger(__name__) ns = api.namespace('blog/posts', description='Operations related to blog posts') @@ -31,7 +30,6 @@ def get(self): per_page = args.get('per_page', 1) posts_query = Post.query posts_page = posts_query.paginate(page, per_page) - return posts_page @api.expect(blog_post_public) @@ -69,7 +67,6 @@ def delete(self, postId): """ Deletes a blog post with matching \"postId\". """ - delete_post(postId) diff --git a/demo_server/demo_server/app.py b/demo_server/demo_server/app.py index 1b5a2be4..57de9a7d 100644 --- a/demo_server/demo_server/app.py +++ b/demo_server/demo_server/app.py @@ -15,6 +15,7 @@ import json from flask import Flask, Blueprint from demo_server import settings +from settings import SQLALCHEMY_DATABASE_URI from demo_server.database.models import db from demo_server.api.blog.endpoints.posts import ns as blog_posts_namespace # from demo_server.api.blog.endpoints.categories import ns\ @@ -40,7 +41,6 @@ def configure_app(flask_app): flask_app.config['RESTPLUS_MASK_SWAGGER'] = settings.RESTPLUS_MASK_SWAGGER flask_app.config['ERROR_404_HELP'] = settings.RESTPLUS_ERROR_404_HELP - def initialize_app(flask_app): configure_app(flask_app) @@ -49,10 +49,8 @@ def initialize_app(flask_app): api.add_namespace(blog_posts_namespace) # api.add_namespace(blog_categories_namespace) flask_app.register_blueprint(blueprint) - db.init_app(flask_app) - def main(): initialize_app(app) # with app.app_context(): @@ -60,5 +58,5 @@ def main(): log.info('>>>>> Starting development server at http://{}/api/ <<<<<'.format(app.config['SERVER_NAME'])) app.run(threaded=True, use_reloader=False, debug=settings.FLASK_DEBUG, host=os.getenv("FLASK_RUN_HOST", "localhost")) -if __name__ == "__main__": - main() +# if __name__ == "__main__": +# main() diff --git a/demo_server/demo_server/database/models.py b/demo_server/demo_server/database/models.py index e0159dc9..74a8fe36 100644 --- a/demo_server/demo_server/database/models.py +++ b/demo_server/demo_server/database/models.py @@ -8,7 +8,9 @@ from datetime import datetime from flask_sqlalchemy import SQLAlchemy - +import pandas as pd +from demo_server import settings +from settings import SQLALCHEMY_DATABASE_URI db = SQLAlchemy() @@ -16,7 +18,7 @@ class Post(db.Model): id = db.Column(db.Integer, primary_key=True) body = db.Column(db.Text) checksum = db.Column(db.Text) - + def __init__(self, body): self.body = body self.checksum = binascii.b2a_hex(os.urandom(100))[:5] diff --git a/demo_server/demo_server/db.sqlite b/demo_server/demo_server/db.sqlite index f50491ef..1dedfd66 100644 Binary files a/demo_server/demo_server/db.sqlite and b/demo_server/demo_server/db.sqlite differ diff --git a/demo_server/demo_server/settings.py b/demo_server/demo_server/settings.py index e1fc085e..177a6e9a 100644 --- a/demo_server/demo_server/settings.py +++ b/demo_server/demo_server/settings.py @@ -2,7 +2,7 @@ # Licensed under the MIT License. # Flask settings -FLASK_SERVER_NAME = 'localhost:8888' +FLASK_SERVER_NAME = 'localhost:8878' FLASK_DEBUG = True # Do not use debug mode in production # Flask-Restplus settings diff --git a/demo_server/demo_server/wrapper.py b/demo_server/demo_server/wrapper.py new file mode 100644 index 00000000..1765acf1 --- /dev/null +++ b/demo_server/demo_server/wrapper.py @@ -0,0 +1,61 @@ +from distutils.log import warn +from logging import warning +from pydoc import resolve +from flask import Flask, request, g +from app import app, main +import warnings +from pandas.core.common import SettingWithCopyWarning + +warning_map = { + "Warning": 289, + "UserWarning": 290, + "DeprecationWarning": 291, + "SyntaxWarning": 292, + "RuntimeWarning": 293, + "FutureWarning": 294, + "PendingDeprecationWarning": 295, + "ImportWarning": 296, + "UnicodeWarning": 297, + "BytesWarning": 298, + "ResourceWarning": 299 +} + +with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + + @app.before_request + def before_req(): + # print('request intercepted before processing') + # print(request) + + # clear warnings before processing requests + w.clear() + + @app.after_request + def after_req(response): + print('response intercepted after processing') + print(response) + + # We can access captured warnings in w + print('When processing the reqeust, the following warnings were observed') + print(w) + + if len(w) > 0: + # Only return the first warning code... + warning_category = w[0].category.__name__ + status_code = warning_map.get(warning_category, warning_map["Warning"]) + response.status_code = status_code + + # Concat message + warning_msg = '' + for warning in w: + warning_msg += str(warning.message) + '\n' + print(warning_msg) + + print('response after warning check') + print(response) + # clear warnings after response + w.clear() + return response + + main() \ No newline at end of file diff --git a/demo_server/requirements.txt b/demo_server/requirements.txt index f441b44d..b1cb8df6 100644 --- a/demo_server/requirements.txt +++ b/demo_server/requirements.txt @@ -1,6 +1,6 @@ -flask==1.1.2 +flask==1.1.02 flask-restplus==0.13.0 Flask-SQLAlchemy==2.5.1 itsdangerous==2.0.1 Werkzeug==0.16.0 - +itsdangerous==2.0.1 diff --git a/demo_server/swagger.json b/demo_server/swagger.json index 861ac06f..5c4278b9 100644 --- a/demo_server/swagger.json +++ b/demo_server/swagger.json @@ -285,5 +285,5 @@ }, "NoResultFound": {} }, - "host": "localhost:8888" + "host": "localhost:8878" } \ No newline at end of file diff --git a/docs/user-guide/Replay.md b/docs/user-guide/Replay.md index 2d6bd326..a180f0b4 100644 --- a/docs/user-guide/Replay.md +++ b/docs/user-guide/Replay.md @@ -39,12 +39,12 @@ so that the sequence can be replayed exactly as it was executed before. Below is an example of the requests and responses from a replay log sequence. ``` --> POST /api/blog/posts HTTP/1.1\r\nAccept: application/json\r\nHost: localhost:8888\r\nContent-Type: application/json\r\n\r\n{\n "id":0,\n "body":"fuzzstring"}\r\n +-> POST /api/blog/posts HTTP/1.1\r\nAccept: application/json\r\nHost: localhost:8878\r\nContent-Type: application/json\r\n\r\n{\n "id":0,\n "body":"fuzzstring"}\r\n ! producer_timing_delay 0 ! max_async_wait_time 0 PREVIOUS RESPONSE: 'HTTP/1.1 201 CREATED\r\nContent-Type: application/json\r\nContent-Length: 45\r\nServer: Werkzeug/0.16.0 Python/3.8.2\r\nDate: Thu, 01 Oct 2020 22:00:27 GMT\r\n\r\n{\n "id": 5875,\n "body": "fuzzstring"\n}\n' --> PUT /api/blog/posts/5875 HTTP/1.1\r\nAccept: application/json\r\nHost: localhost:8888\r\nContent-Type: application/json\r\n\r\n{"body":"fuzzstring"} +-> PUT /api/blog/posts/5875 HTTP/1.1\r\nAccept: application/json\r\nHost: localhost:8878\r\nContent-Type: application/json\r\n\r\n{"body":"fuzzstring"} ! producer_timing_delay 0 ! max_async_wait_time 0 PREVIOUS RESPONSE: 'HTTP/1.1 500 INTERNAL SERVER ERROR\r\nContent-Type: application/json\r\nContent-Length: 176\r\nServer: Werkzeug/0.16.0 Python/3.8.2\r\nDate: Thu, 01 Oct 2020 22:00:28 GMT\r\n\r\n{\n "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."\n}\n' diff --git a/docs/user-guide/Testing.md b/docs/user-guide/Testing.md index 13769afc..62c662f9 100644 --- a/docs/user-guide/Testing.md +++ b/docs/user-guide/Testing.md @@ -94,7 +94,7 @@ During each Test run a `speccov.json` file will be created in the logs directory "request_uri": "/api/blog/posts/5872", "request_headers": [ "Accept: application/json", - "Host: localhost:8888", + "Host: localhost:8878", "Content-Type: application/json" ], "request_body": "{\n \"id\":\"5872\",\n \"checksum\":\"fuzzstring\",\n \"body\":\"first blog\"}\r\n", diff --git a/docs/user-guide/TutorialDemoServer.md b/docs/user-guide/TutorialDemoServer.md index 3f599e53..d0a64c3a 100644 --- a/docs/user-guide/TutorialDemoServer.md +++ b/docs/user-guide/TutorialDemoServer.md @@ -58,7 +58,7 @@ In this example, coverage is 5 / 6 and the only INVALID request is + restler_fuzzable_int: ['0', '1'] - restler_static_string: ' HTTP/1.1\r\n' - restler_static_string: 'Accept: application/json\r\n' - - restler_static_string: 'Host: localhost:8888\r\n' + - restler_static_string: 'Host: localhost:8878\r\n' - restler_static_string: '\r\n' By looking at `network.testing.<...>.txt`, we can see that RESTler attempts to execute this request 4 times, each time with a value either 0 or 1 for the `per_page=` and `page=`. It turns out none of these 4 combinations are valid: the `per_page=` must be 2 minimally, but RESTler was not able to infer this automatically. (One way to fix this is to edit `dict.json` and add the value `2` in the list for `restler_fuzzable_int`.) diff --git a/motivating_server/CoursesStudentNamesID/app.py b/motivating_server/CoursesStudentNamesID/app.py new file mode 100644 index 00000000..c258c9ab --- /dev/null +++ b/motivating_server/CoursesStudentNamesID/app.py @@ -0,0 +1,29 @@ +from flask import Flask, jsonify, request, abort + +app = Flask(__name__) + +@app.route("/get_class_names") +def get_class_names(): + classes = ['compiler', 'physics', 'automated_testing'] + return jsonify(classes) + +# /get_students_and_ids?class_name=compiler +@app.route("/get_students_and_ids") +def get_students_and_ids(): + class_name = request.args.get('class_name', '') + if class_name == 'compiler': + students_and_ids = [('Aatrox', '1111111111'), ('Ahri', '22222222'), ('Akali', '333333333')] + return jsonify(students_and_ids) + elif class_name == 'physics': + students_and_ids = [('Elise', '24253245'), ('Ekko', '23645126'), ('Jax', '7643325345')] + return jsonify(students_and_ids) + elif class_name == 'automated_testing': + # Notice there's a missing comma in the list below + students_and_ids = [('Sett', '425145'), ('Urgot', '52342543')('Ziggs', '5722145')] + return jsonify(students_and_ids) + else: + # Not found + abort(404) + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=11111) \ No newline at end of file diff --git a/motivating_server/LRUCache.py b/motivating_server/LRUCache.py new file mode 100644 index 00000000..2eda6258 --- /dev/null +++ b/motivating_server/LRUCache.py @@ -0,0 +1,46 @@ +""" +Modified from + https://www.geeksforgeeks.org/lru-cache-in-python-using-ordereddict/ +""" + +from collections import OrderedDict +from random import randrange + + +class LRUCache: + def __init__(self): + self.cache = OrderedDict() + + def get(self, key): + if key not in self.cache: + return -1 + else: + self.cache.move_to_end(key) + return self.cache[key] + + def put(self, key, value): + self.cache[key] = value + self.cache.move_to_end(key) + + # 1000 is the hard-coded LRU cache capacity + # The line below will raise a 'warning' + if 1000 is (len(self.cache) - 1): + self.cache.popitem(last=False) + + +if __name__ == '__main__': + # RUNNER + # initializing our cache with the capacity of 1000 + cache = LRUCache() + + num_test_records = 10000 + + for idx in range(num_test_records): + key, value = idx, randrange(10000) + cache.put(key, value) + cache_len = len(cache.cache) + + print(f'Number of entries in LRU cache is {cache_len}') + + + diff --git a/prototype/app.py b/prototype/app.py new file mode 100644 index 00000000..f407991b --- /dev/null +++ b/prototype/app.py @@ -0,0 +1,15 @@ +from flask import Flask +import warnings +app = Flask(__name__) + +@app.route('/') +def hello_world(): + # no warning here + return 'helloworld' + +@app.route('/deprecated_api') +def deprecated(): + warnings.warn("devil hides in the detail: deprecated", DeprecationWarning) + return 'everything looks perfectly fine!!' +if __name__ == '__main__': + app.run(debug=True, host='0.0.0.0') \ No newline at end of file diff --git a/prototype/wrapper.py b/prototype/wrapper.py new file mode 100644 index 00000000..c904c651 --- /dev/null +++ b/prototype/wrapper.py @@ -0,0 +1,30 @@ +from flask import Flask, request, g +from app import app +import warnings + +with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + + @app.before_request + def before_req(): + print('request intercepted before processing') + print(request) + + # clear warnings before processing requests + w.clear() + + + @app.after_request + def after_req(response): + print('response intercepted after processing') + print(response) + + # We can access captured warnings in w + print('When processing the reqeust, the following warnings were observed') + print(w) + + # clear warnings after response + w.clear() + return response + + app.run(debug=True, host='0.0.0.0') \ No newline at end of file diff --git a/restler/engine/transport_layer/response.py b/restler/engine/transport_layer/response.py index 5b7897cf..542fdeb5 100644 --- a/restler/engine/transport_layer/response.py +++ b/restler/engine/transport_layer/response.py @@ -5,7 +5,7 @@ from restler_settings import Settings DELIM = "\r\n\r\n" -VALID_CODES = {'200', '201', '202', '204', '304'} +VALID_CODES = {'200', '201', '202', '204', '304', '290', '291', '292', '293', '294', '295', '296', '297', '298', '299' } TIMEOUT_CODE = '599' CONNECTION_CLOSED_CODE = '598' RESTLER_BUG_CODES = [TIMEOUT_CODE, CONNECTION_CLOSED_CODE] diff --git a/restler/restler.py b/restler/restler.py index 52cf63e8..90119c93 100644 --- a/restler/restler.py +++ b/restler/restler.py @@ -62,7 +62,7 @@ def import_grammar(path): shutil.copyfile(path, target_path) except shutil.Error: pass - + print("request collection",req_collection) return req_collection def get_checker_list(req_collection, fuzzing_requests, enable_list, disable_list, set_enable_first, custom_checkers, enable_default_checkers=True): diff --git a/src/ResultsAnalyzer/Analyze/Types.fs b/src/ResultsAnalyzer/Analyze/Types.fs index 36d73af9..15b2aa4d 100644 --- a/src/ResultsAnalyzer/Analyze/Types.fs +++ b/src/ResultsAnalyzer/Analyze/Types.fs @@ -8,17 +8,33 @@ open System.Text.RegularExpressions [] let UnknownResponseCode = 0 +let WarningResponseCode = [ 289 .. 299 ] [] let BugResponseCode = 500 let isFailure x = x >= 400 || // Consider these a failure as well, so they are analyzed. - x = UnknownResponseCode + x = UnknownResponseCode || + List.contains x WarningResponseCode let isBug x = x = BugResponseCode +let containsWarning x = + match x with + | 289 -> "Warning" + | 290 -> "UserWarning" + | 291 -> "DeprecationWarning" + | 292 -> "SyntaxWarning" + | 293 -> "RuntimeWarning" + | 294 -> "FutureWarning" + | 295 -> "PendingDeprecationWarning" + | 296 -> "ImportWarning" + | 297 -> "UnicodeWarning" + | 298 -> "BytesWarning" + | 299 -> "ResourceWarning" + // TODO replace the Http types here with the ones in Common.Http and Common.Log type HttpRequestData = @@ -41,6 +57,9 @@ type HttpResponseData = member x.isBug = isBug x.code + member x.containsWarning = + containsWarning x.code + type RequestTrace = | RequestData of HttpRequestData /// In some cases, the request RESTler sends is not well-formed diff --git a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_deps_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_deps_grammar.py index 854bc306..952fb62e 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_deps_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_deps_grammar.py @@ -57,7 +57,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string("user"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -87,7 +87,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string("user"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("user-id: "), primitives.restler_static_string(_service_user_post_user_id_header.reader(), quoted=False), primitives.restler_static_string("\r\n"), @@ -109,7 +109,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string("user"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("user-id: "), primitives.restler_static_string(_service_user_post_user_id_header.reader(), quoted=False), primitives.restler_static_string("\r\n"), @@ -131,7 +131,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string("user"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("user-id: "), primitives.restler_static_string(_service_user_post_user_id_header.reader(), quoted=False), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_annotation_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_annotation_grammar.py index 605ae357..97127d70 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_annotation_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_annotation_grammar.py @@ -57,7 +57,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string("user"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -89,7 +89,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string(_service_user_post_Location_header.reader(), quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -110,7 +110,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string(_service_user_post_Location_header.reader(), quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -131,7 +131,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string(_service_user_post_Location_header.reader(), quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_grammar.py index 73e29e71..021d683e 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/header_response_writer_grammar.py @@ -57,7 +57,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string("user"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -89,7 +89,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string(_service_user_post_userId_header.reader(), quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -110,7 +110,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string(_service_user_post_userId_header.reader(), quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -131,7 +131,7 @@ def parse_serviceuserpost(data, **kwargs): primitives.restler_static_string(_service_user_post_userId_header.reader(), quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/ordering_test_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/ordering_test_grammar.py index ecf4e248..a0dafdb6 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/ordering_test_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/ordering_test_grammar.py @@ -18,7 +18,7 @@ primitives.restler_static_string("products"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -47,7 +47,7 @@ primitives.restler_static_string("services"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -77,7 +77,7 @@ primitives.restler_static_string("managementTools"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_annotation_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_annotation_grammar.py index fa87e5fb..59de9949 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_annotation_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_annotation_grammar.py @@ -80,7 +80,7 @@ def parse_storespost(data, **kwargs): primitives.restler_static_string("stores"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -114,7 +114,7 @@ def parse_storespost(data, **kwargs): primitives.restler_static_string("order"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_in_dictionary_payload_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_in_dictionary_payload_grammar.py index bdf481fc..40e54141 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_in_dictionary_payload_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/dependencyTests/path_in_dictionary_payload_grammar.py @@ -54,7 +54,7 @@ def parse_storespost(data, **kwargs): primitives.restler_static_string("stores"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -86,7 +86,7 @@ def parse_storespost(data, **kwargs): primitives.restler_static_string("order"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/dictionaryTests/quoted_primitives_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/dictionaryTests/quoted_primitives_grammar.py index 7ce6bec9..23a4a84e 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/dictionaryTests/quoted_primitives_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/dictionaryTests/quoted_primitives_grammar.py @@ -54,7 +54,7 @@ def parse_storespost(data, **kwargs): primitives.restler_static_string("stores"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -86,7 +86,7 @@ def parse_storespost(data, **kwargs): primitives.restler_static_string(_stores_post_id.reader(), quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), primitives.restler_static_string("\r\n"), @@ -135,7 +135,7 @@ def parse_storespost(data, **kwargs): primitives.restler_custom_payload("message", quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/exampleTests/array_example_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/exampleTests/array_example_grammar.py index 113bdc84..b749e254 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/exampleTests/array_example_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/exampleTests/array_example_grammar.py @@ -54,7 +54,7 @@ def parse_storesstoreIdorderpost(data, **kwargs): primitives.restler_static_string("stores"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), @@ -99,7 +99,7 @@ def parse_storesstoreIdorderpost(data, **kwargs): primitives.restler_static_string("fff"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), primitives.restler_static_string("\r\n"), @@ -158,7 +158,7 @@ def parse_storesstoreIdorderpost(data, **kwargs): primitives.restler_fuzzable_string("fuzzstring", quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_refreshable_authentication_token("authentication_token_tag"), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.json b/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.json index 170212dc..9da62551 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.json +++ b/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.json @@ -112,7 +112,7 @@ ], [ "Host", - "localhost:8888" + "localhost:8878" ] ], "httpVersion": "1.1", @@ -340,7 +340,7 @@ ], [ "Host", - "localhost:8888" + "localhost:8878" ] ], "httpVersion": "1.1", diff --git a/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.py b/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.py index fd836fe8..a08c6ef6 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.py +++ b/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar.py @@ -14,7 +14,7 @@ primitives.restler_static_string("customers"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), primitives.restler_static_string("\r\n"), @@ -46,7 +46,7 @@ primitives.restler_fuzzable_string("fuzzstring", quoted=False), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("array_header_param: "), primitives.restler_fuzzable_string("fuzzstring", quoted=False), primitives.restler_static_string("\r\n"), diff --git a/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar_requiredonly.py b/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar_requiredonly.py index b62c12d5..98b849d8 100644 --- a/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar_requiredonly.py +++ b/src/compiler/Restler.Compiler.Test/baselines/grammarTests/required_params_grammar_requiredonly.py @@ -14,7 +14,7 @@ primitives.restler_static_string("customers"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), primitives.restler_static_string("\r\n"), @@ -37,7 +37,7 @@ primitives.restler_static_string("customers"), primitives.restler_static_string(" HTTP/1.1\r\n"), primitives.restler_static_string("Accept: application/json\r\n"), - primitives.restler_static_string("Host: localhost:8888\r\n"), + primitives.restler_static_string("Host: localhost:8878\r\n"), primitives.restler_static_string("\r\n"), primitives.restler_static_string("Content-Type: "), primitives.restler_static_string("application/json"), diff --git a/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotation.json b/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotation.json index 11b1402c..654a1b25 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotation.json +++ b/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotation.json @@ -180,7 +180,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotationInSeparateFile.json b/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotationInSeparateFile.json index 38c23eb6..d18520dc 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotationInSeparateFile.json +++ b/src/compiler/Restler.Compiler.Test/swagger/annotationTests/pathAnnotationInSeparateFile.json @@ -166,7 +166,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/array_example.json b/src/compiler/Restler.Compiler.Test/swagger/array_example.json index 18f134da..895741f4 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/array_example.json +++ b/src/compiler/Restler.Compiler.Test/swagger/array_example.json @@ -129,7 +129,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/array_example_external.json b/src/compiler/Restler.Compiler.Test/swagger/array_example_external.json index 07990853..5992b1a0 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/array_example_external.json +++ b/src/compiler/Restler.Compiler.Test/swagger/array_example_external.json @@ -129,7 +129,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger1.json b/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger1.json index 09b2afd9..b2c97698 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger1.json +++ b/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger1.json @@ -161,7 +161,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger2.json b/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger2.json index 857f7335..8b64cbe4 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger2.json +++ b/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger2.json @@ -161,7 +161,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger3.json b/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger3.json index e17bad3d..9c1b9937 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger3.json +++ b/src/compiler/Restler.Compiler.Test/swagger/configTests/swagger3.json @@ -165,7 +165,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/demo_server.json b/src/compiler/Restler.Compiler.Test/swagger/demo_server.json index 788c65dc..a419b11b 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/demo_server.json +++ b/src/compiler/Restler.Compiler.Test/swagger/demo_server.json @@ -76,7 +76,7 @@ ] } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple demonstration of a Flask RestPlus powered API", "title": "My Blog API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/array_dep_multiple_items.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/array_dep_multiple_items.json index 54c620ec..55ab9e29 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/array_dep_multiple_items.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/array_dep_multiple_items.json @@ -122,7 +122,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/body_dependency_cycles.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/body_dependency_cycles.json index c5791ada..036200c8 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/body_dependency_cycles.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/body_dependency_cycles.json @@ -69,7 +69,7 @@ } } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example that produces cycles due to body dependencies.", "title": "Cycle body dependencies regression test", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/frontend_port_id.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/frontend_port_id.json index 9e6a1aaa..0bfa6dea 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/frontend_port_id.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/frontend_port_id.json @@ -314,7 +314,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for object with embedded consumer.", "title": "Subnet dependencies regression test", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/header_deps.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/header_deps.json index 78301f90..51870199 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/header_deps.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/header_deps.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for header dependencies.", "title": "The title.", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/inconsistent_casing_paths.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/inconsistent_casing_paths.json index 5e2fbb1a..06519418 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/inconsistent_casing_paths.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/inconsistent_casing_paths.json @@ -19,7 +19,7 @@ "x-ms-azure-resource": true } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for inconsistent casing paths.", "title": "Inconsistent casing path dependencies regression test", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/input_producer_spec.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/input_producer_spec.json index 84b9b2b4..c345caf9 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/input_producer_spec.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/input_producer_spec.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for POST with input producer", "title": "Input producer test case", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ip_configurations_get.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ip_configurations_get.json index 005ace1d..216a4eb0 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ip_configurations_get.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ip_configurations_get.json @@ -278,7 +278,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for object with embedded consumer.", "title": "Subnet dependencies regression test", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/lowercase_paths.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/lowercase_paths.json index b40ddf44..0ba5e8ee 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/lowercase_paths.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/lowercase_paths.json @@ -15,7 +15,7 @@ "x-ms-azure-resource": true } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for lowercase paths.", "title": "Lowercase path dependencies regression test", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/nested_objects_naming.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/nested_objects_naming.json index 197e9bb3..a775887b 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/nested_objects_naming.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/nested_objects_naming.json @@ -199,7 +199,7 @@ } } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for object with embedded consumer.", "title": "Subnet dependencies regression test", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ordering_test.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ordering_test.json index b35cf804..611c9615 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ordering_test.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/ordering_test.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for ordering constraints.", "title": "The title.", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/post_patch_dependency.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/post_patch_dependency.json index 5952d435..3e0f25d1 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/post_patch_dependency.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/post_patch_dependency.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for POST and dependent PATCH.", "title": "patch dependency test case.", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/response_headers.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/response_headers.json index 5f82fff8..48ca531f 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/response_headers.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/response_headers.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for header dependencies.", "title": "The title.", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/subnet_id.json b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/subnet_id.json index b5e9dbd7..c015cc6e 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/subnet_id.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dependencyTests/subnet_id.json @@ -121,7 +121,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Small example for object with embedded consumer.", "title": "Subnet dependencies regression test", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/customPayloadSwagger.json b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/customPayloadSwagger.json index 4d4ea929..6420a766 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/customPayloadSwagger.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/customPayloadSwagger.json @@ -175,7 +175,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/multipleIdenticalUuidSuffix.json b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/multipleIdenticalUuidSuffix.json index 77d4d585..40c9abd8 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/multipleIdenticalUuidSuffix.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/multipleIdenticalUuidSuffix.json @@ -24,7 +24,7 @@ } } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Resource API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/no_params.json b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/no_params.json index 73c3dd69..b0fd9041 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/no_params.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/no_params.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec with one header and one query parameter.", "title": "Simple spec", diff --git a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/pathDictionaryPayload.json b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/pathDictionaryPayload.json index 7af7db5f..2a0a46ca 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/pathDictionaryPayload.json +++ b/src/compiler/Restler.Compiler.Test/swagger/dictionaryTests/pathDictionaryPayload.json @@ -170,7 +170,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/empty_array_example.json b/src/compiler/Restler.Compiler.Test/swagger/empty_array_example.json index 292e0d4e..987bc171 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/empty_array_example.json +++ b/src/compiler/Restler.Compiler.Test/swagger/empty_array_example.json @@ -115,7 +115,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/exactCopy/array_example.json b/src/compiler/Restler.Compiler.Test/swagger/exactCopy/array_example.json index 26e604e7..a22ce673 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/exactCopy/array_example.json +++ b/src/compiler/Restler.Compiler.Test/swagger/exactCopy/array_example.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "Parameter examples", diff --git a/src/compiler/Restler.Compiler.Test/swagger/example_demo.json b/src/compiler/Restler.Compiler.Test/swagger/example_demo.json index 468f6ff9..6d73c551 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/example_demo.json +++ b/src/compiler/Restler.Compiler.Test/swagger/example_demo.json @@ -116,7 +116,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/example_demo1.json b/src/compiler/Restler.Compiler.Test/swagger/example_demo1.json index 27bbee5d..50425312 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/example_demo1.json +++ b/src/compiler/Restler.Compiler.Test/swagger/example_demo1.json @@ -121,7 +121,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/example_demo1.yaml b/src/compiler/Restler.Compiler.Test/swagger/example_demo1.yaml index 5938a713..6881b8fe 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/example_demo1.yaml +++ b/src/compiler/Restler.Compiler.Test/swagger/example_demo1.yaml @@ -84,7 +84,7 @@ definitions: $ref: '#/definitions/KeyType' description: The key type. description: The callback url parameters. -host: 'localhost:8888' +host: 'localhost:8878' info: description: A simple swagger spec that uses examples title: My Grocery API diff --git a/src/compiler/Restler.Compiler.Test/swagger/get_path_dependencies.json b/src/compiler/Restler.Compiler.Test/swagger/get_path_dependencies.json index 005d1d09..4764e578 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/get_path_dependencies.json +++ b/src/compiler/Restler.Compiler.Test/swagger/get_path_dependencies.json @@ -179,7 +179,7 @@ }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "", "title": "Based on ApplicationGateway.json", diff --git a/src/compiler/Restler.Compiler.Test/swagger/grammarTests/required_params.json b/src/compiler/Restler.Compiler.Test/swagger/grammarTests/required_params.json index 43635b64..502ce2d8 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/grammarTests/required_params.json +++ b/src/compiler/Restler.Compiler.Test/swagger/grammarTests/required_params.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses required and optional parameters", "title": "Parameters example spec", diff --git a/src/compiler/Restler.Compiler.Test/swagger/headers.json b/src/compiler/Restler.Compiler.Test/swagger/headers.json index b0d69011..b74d5955 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/headers.json +++ b/src/compiler/Restler.Compiler.Test/swagger/headers.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses headers", "title": "Header example spec", diff --git a/src/compiler/Restler.Compiler.Test/swagger/inline_examples.json b/src/compiler/Restler.Compiler.Test/swagger/inline_examples.json index 39b7e34e..114e5d4e 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/inline_examples.json +++ b/src/compiler/Restler.Compiler.Test/swagger/inline_examples.json @@ -3,7 +3,7 @@ "consumes": [ "application/json" ], - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses inline examples", "title": "Inline example spec", diff --git a/src/compiler/Restler.Compiler.Test/swagger/object_example.json b/src/compiler/Restler.Compiler.Test/swagger/object_example.json index fa04bbf8..aebf5468 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/object_example.json +++ b/src/compiler/Restler.Compiler.Test/swagger/object_example.json @@ -115,7 +115,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/put_createorupdate.json b/src/compiler/Restler.Compiler.Test/swagger/put_createorupdate.json index 73d2e9a9..5845eafa 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/put_createorupdate.json +++ b/src/compiler/Restler.Compiler.Test/swagger/put_createorupdate.json @@ -115,7 +115,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "A simple swagger spec that uses examples", "title": "My Grocery API", diff --git a/src/compiler/Restler.Compiler.Test/swagger/schemaTests/global_path_parameters.json b/src/compiler/Restler.Compiler.Test/swagger/schemaTests/global_path_parameters.json index 1aad56f8..d454c7e0 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/schemaTests/global_path_parameters.json +++ b/src/compiler/Restler.Compiler.Test/swagger/schemaTests/global_path_parameters.json @@ -5,7 +5,7 @@ "version": "1" }, - "host": "localhost:8888", + "host": "localhost:8878", "paths": { "/customer/{customerId}": { "put": { diff --git a/src/compiler/Restler.Compiler.Test/swagger/schemaTests/large_json_body.json b/src/compiler/Restler.Compiler.Test/swagger/schemaTests/large_json_body.json index e503a17a..1ab709ec 100644 --- a/src/compiler/Restler.Compiler.Test/swagger/schemaTests/large_json_body.json +++ b/src/compiler/Restler.Compiler.Test/swagger/schemaTests/large_json_body.json @@ -122,7 +122,7 @@ } }, - "host": "localhost:8888", + "host": "localhost:8878", "info": { "description": "Example with deep json body and both arrays, properties, and objects.", "title": "Test json nesting depth", diff --git a/wrapper/app.py b/wrapper/app.py new file mode 100644 index 00000000..d85ab4a8 --- /dev/null +++ b/wrapper/app.py @@ -0,0 +1,21 @@ +from flask import Flask +import warnings +app = Flask(__name__) + + +@app.route('/') +def hello_world(): + # no warning here + return 'helloworld' + + +@app.route('/deprecated_api') +def deprecated(): + + warnings.warn("devil hides in the detail: deprecated", DeprecationWarning) + + return 'everything looks perfectly fine!!' + + +if __name__ == '__main__': + app.run(debug=True, host='0.0.0.0') \ No newline at end of file diff --git a/wrapper/wrapper.py b/wrapper/wrapper.py new file mode 100644 index 00000000..c6e2b7d8 --- /dev/null +++ b/wrapper/wrapper.py @@ -0,0 +1,50 @@ +from flask import Flask, request, g +from app import app +import warnings + +warning_map = { + "Warning": 289, + "UserWarning": 290, + "DeprecationWarning": 291, + "SyntaxWarning": 292, + "RuntimeWarning": 293, + "FutureWarning": 294, + "PendingDeprecationWarning": 295, + "ImportWarning": 296, + "UnicodeWarning": 297, + "BytesWarning": 298, + "ResourceWarning": 299 +} + +with warnings.catch_warnings(record=True) as w: + warnings.simplefilter("always") + + @app.before_request + def before_req(): + print('request intercepted before processing') + print(request) + + # clear warnings before processing requests + w.clear() + + + @app.after_request + def after_req(response): + print('response intercepted after processing') + print(response) + + # We can access captured warnings in w + print('When processing the reqeust, the following warnings were observed') + print(w) + + if len(w) > 0: + # Only return the first warning... + warning_category = w[0].category.__name__ + status_code = warning_map.get(warning_category, warning_map["Warning"]) + response.status_code = status_code + + # clear warnings after response + w.clear() + return response + + app.run(debug=True, host='0.0.0.0') \ No newline at end of file