Skip to content

Commit

Permalink
Use empty headers dict for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Oct 28, 2024
1 parent 5fa3c18 commit a3bd1cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 0 additions & 8 deletions cdxj_indexer/postquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ def handle_binary(query_data):
query = handle_binary(query_data)

elif mime.startswith("multipart/"):
# env = {
# "REQUEST_METHOD": "POST",
# "CONTENT_TYPE": mime,
# "CONTENT_LENGTH": len(query_data),
# }

# args = dict(fp=BytesIO(query_data), environ=env, keep_blank_values=True)

try:
_, params = parse_options_header(request_headers)
boundary = params["boundary"]
Expand Down
10 changes: 8 additions & 2 deletions test/test_postappend.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,22 @@

# ============================================================================
class MethodQueryCanonicalizer:
def __init__(self, method, content_type, req_len, req_stream):
def __init__(self, method, content_type, req_len, req_stream, req_headers={}):
self.method = method
self.content_type = content_type
self.req_len = req_len
self.req_stream = req_stream
self.req_headers = req_headers

def append_query(self, url):
self.req_stream.seek(0)
query_only, full_string = append_method_query(
self.method, self.content_type, self.req_len, self.req_stream, url
self.method,
self.content_type,
self.req_len,
self.req_stream,
url,
self.req_headers,
)
return url + full_string

Expand Down

0 comments on commit a3bd1cb

Please sign in to comment.