Skip to content

Commit e88bfe6

Browse files
committed
fix: Use standard \r\n for the http custom header to avoid problem get/post to http serversd
1 parent 3ceb3c2 commit e88bfe6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/http/get_with_custom_header.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343

4444

4545
# Custom header
46-
HEADER = "\n".join(
46+
HEADER = "\r\n".join(
4747
[
4848
f"GET {query} HTTP/1.1",
4949
f"Host: {host}",
5050
"Custom-Header-Name: Custom-Data",
5151
"Content-Type: application/json",
52-
"Content-Length: 0\n",
53-
"\n\n",
52+
"Content-Length: 0",
53+
"\r\n",
5454
]
5555
)
5656

examples/http/post_with_custom_header.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646
payload = json.dumps(DATA_TO_POST)
4747

4848
# Custom header
49-
HEADER = "\n".join(
49+
HEADER = "\r\n".join(
5050
[
5151
f"POST /{query} HTTP/1.1",
5252
f"Host: {host}",
5353
"Custom-Header-Name: Custom-Data",
5454
"Content-Type: application/json",
55-
f"Content-Length: {len(payload)+1}",
56-
"\n\n",
55+
f"Content-Length: {len(payload) + 1}",
56+
"\r\n",
5757
]
5858
)
5959

0 commit comments

Comments
 (0)