Skip to content

Commit a336fa8

Browse files
committed
Merge pull request #151 from forrest-mao/add_callback_feature
add callback feature
2 parents d8fe216 + 8721adb commit a336fa8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

qiniu/auth.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
'callbackUrl',
1515
'callbackBody',
1616
'callbackHost',
17+
'callbackBodyType',
18+
'callbackFetchKey',
1719

1820
'returnUrl',
1921
'returnBody',
@@ -67,6 +69,7 @@ def token_of_request(self, url, body=None, content_type=None):
6769
if body:
6870
mimes = [
6971
'application/x-www-form-urlencoded',
72+
'application/json'
7073
]
7174
if content_type in mimes:
7275
data += body
@@ -115,8 +118,8 @@ def __upload_token(self, policy):
115118
data = json.dumps(policy, separators=(',', ':'))
116119
return self.token_with_data(data)
117120

118-
def verify_callback(self, origin_authorization, url, body):
119-
token = self.token_of_request(url, body, 'application/x-www-form-urlencoded')
121+
def verify_callback(self, origin_authorization, url, body, content_type='application/x-www-form-urlencoded'):
122+
token = self.token_of_request(url, body, content_type)
120123
authorization = 'QBox {0}'.format(token)
121124
return origin_authorization == authorization
122125

0 commit comments

Comments
 (0)