1, refactor ResponseObject;
2, response can be modified in teardown_hooks.
This commit is contained in:
httprunner
2018-05-31 00:36:10 +08:00
parent c23016f3c1
commit 89cc9a2d1e
9 changed files with 142 additions and 162 deletions

View File

@@ -95,19 +95,6 @@ def get_token():
response.headers["Content-Type"] = "application/json"
return response
@app.route('/customize-response', methods=['POST'])
def get_customized_response():
expected_resp_json = request.get_json()
status_code = expected_resp_json.get('status_code', 200)
headers_dict = expected_resp_json.get('headers', {})
body = expected_resp_json.get('body', {})
response = make_response(json.dumps(body), status_code)
for header_key, header_value in headers_dict.items():
response.headers[header_key] = header_value
return response
@app.route('/api/users')
@validate_request
def get_users():