mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-16 21:17:36 +08:00
1.4.5:
1, refactor ResponseObject; 2, response can be modified in teardown_hooks.
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user