Skip to content

Commit

Permalink
Straight to the point canonical request
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin-b committed Feb 4, 2024
1 parent 76900b7 commit 10185e6
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions httpx_auth/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,17 @@ def auth_flow(
def _get_canonical_request(
self, req: httpx.Request, canonical_headers: str, signed_headers: str
) -> str:
canonical_uri = self._get_canonical_uri(req.url)
canonical_query_string = self._get_canonical_query_string(req.url)
hashed_payload = req.headers["x-amz-content-sha256"]
req_parts = [
req.method.upper(),
canonical_uri,
canonical_query_string,
canonical_headers,
signed_headers,
hashed_payload,
]
return "\n".join(req_parts)
return "\n".join(
[
req.method.upper(),
self._get_canonical_uri(req.url),
self._get_canonical_query_string(req.url),
canonical_headers,
signed_headers,
# Hashed payload
req.headers["x-amz-content-sha256"],
]
)

def _get_canonical_headers(self, req: httpx.Request) -> Tuple[str, str]:
"""
Expand Down

0 comments on commit 10185e6

Please sign in to comment.