mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +08:00
use utils.gen_md5 function to generate md5 value
This commit is contained in:
+2
-2
@@ -3,6 +3,7 @@ import json
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from flask import Flask, make_response, request
|
from flask import Flask, make_response, request
|
||||||
|
from ate import utils
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@@ -36,8 +37,7 @@ def validate_request(func):
|
|||||||
req_authorization = req_headers['Authorization']
|
req_authorization = req_headers['Authorization']
|
||||||
random_str = req_headers['Random']
|
random_str = req_headers['Random']
|
||||||
data = request.data.decode("utf-8")
|
data = request.data.decode("utf-8")
|
||||||
authorization_str = "".join([TOKEN, data, random_str])
|
authorization = utils.gen_md5([TOKEN, data, random_str])
|
||||||
authorization = hashlib.md5(authorization_str.encode('utf-8')).hexdigest()
|
|
||||||
assert authorization == req_authorization
|
assert authorization == req_authorization
|
||||||
return func(*args, **kwds)
|
return func(*args, **kwds)
|
||||||
except (KeyError, AssertionError):
|
except (KeyError, AssertionError):
|
||||||
|
|||||||
Reference in New Issue
Block a user