Skip to content

Commit

Permalink
Making the logic unit test compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
kishore7snehil committed Feb 12, 2025
1 parent acfdfaa commit d8e14f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions auth0/authentication/pushed_authorization_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from .base import AuthenticationBase

from urllib.parse import urlencode


class PushedAuthorizationRequests(AuthenticationBase):
Expand All @@ -23,14 +22,14 @@ def pushed_authorization_request(
See: https://www.rfc-editor.org/rfc/rfc9126.html
"""
return self.post(
return self.authenticated_post(
f"{self.protocol}://{self.domain}/oauth/par",
data=urlencode({
data={
"client_id":self.client_id,
"client_secret":self.client_secret,
"response_type": response_type,
"redirect_uri": redirect_uri,
**kwargs,
}),
},
headers={"Content-Type": "application/x-www-form-urlencoded"},
)
3 changes: 2 additions & 1 deletion auth0/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from random import randint
from time import sleep
from typing import TYPE_CHECKING, Any, Mapping
from urllib.parse import urlencode

import requests

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

Check warning on line 160 in auth0/rest.py

View check run for this annotation

Codecov / codecov/patch

auth0/rest.py#L159-L160

Added lines #L159 - L160 were not covered by tests

kwargs = {
Expand Down

0 comments on commit d8e14f8

Please sign in to comment.