Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit ae2fdc6

Browse files
committed
Fix main.py
1 parent a67d917 commit ae2fdc6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def http_request(self, method, url, body=None, headers=None):
8686
status_code = int(status_line.split(" ")[1])
8787

8888
# Return the status code and the body of the response
89-
return status_code, body.decode("utf-8", errors="ignore")
89+
return {status_code, body.decode("utf-8", errors="ignore")}
9090

9191
def head(self, url, headers=None):
9292
"""Carry out a HEAD request and returns status_code and empty body."""

main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ def main():
4848

4949
# Handle DELETE request
5050
elif args.method.upper() == "DELETE":
51-
status_code, response_body = client.delete(args.url, body=args.data, headers=headers)
51+
return client.delete(args.url, body=args.data, headers=headers)
5252

5353
# Handle PATCH request
5454
elif args.method.upper() == "PATCH":
55-
status_code, response_body = client.patch(args.url, body=args.data, headers=headers)
55+
return client.patch(args.url, body=args.data, headers=headers)
5656

5757
# Handle PUT request
5858
elif args.method.upper() == "PUT":
59-
status_code, response_body = client.put(args.url, body=args.data, headers=headers)
59+
return client.put(args.url, body=args.data, headers=headers)
6060

6161
# Handle other HTTP methods (e.g., GET, POST)
6262
else:
63-
status_code, response_body = client.http_request(
63+
return client.http_request(
6464
method=args.method.upper(),
6565
url=args.url,
6666
body=args.data,

0 commit comments

Comments
 (0)