Skip to content

Commit d8e14f8

Browse files
Making the logic unit test compatible
1 parent acfdfaa commit d8e14f8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

auth0/authentication/pushed_authorization_requests.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from .base import AuthenticationBase
44

5-
from urllib.parse import urlencode
65

76

87
class PushedAuthorizationRequests(AuthenticationBase):
@@ -23,14 +22,14 @@ def pushed_authorization_request(
2322
2423
See: https://www.rfc-editor.org/rfc/rfc9126.html
2524
"""
26-
return self.post(
25+
return self.authenticated_post(
2726
f"{self.protocol}://{self.domain}/oauth/par",
28-
data=urlencode({
27+
data={
2928
"client_id":self.client_id,
3029
"client_secret":self.client_secret,
3130
"response_type": response_type,
3231
"redirect_uri": redirect_uri,
3332
**kwargs,
34-
}),
33+
},
3534
headers={"Content-Type": "application/x-www-form-urlencoded"},
3635
)

auth0/rest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from random import randint
88
from time import sleep
99
from typing import TYPE_CHECKING, Any, Mapping
10+
from urllib.parse import urlencode
1011

1112
import requests
1213

@@ -155,7 +156,7 @@ def _request(
155156
if data is None and json is not None and headers:
156157
content_type = headers.get("Content-Type", "").lower() # Get Content-Type
157158
if "application/x-www-form-urlencoded" in content_type:
158-
data = json # Copy JSON data into data
159+
data = urlencode(json) # Copy JSON data into data
159160
json = None # Prevent JSON from being sent
160161

161162
kwargs = {

0 commit comments

Comments
 (0)