Skip to content

Commit b499978

Browse files
committed
Fixed header concatenation bug
1 parent c2d41b7 commit b499978

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

servercom/implementations/circuitpy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ def _do_request(
245245
f"{method} {path} HTTP/1.1\r\n" +
246246
"Host: api.local\r\n" +
247247
"Connection: close\r\n" +
248-
f"Authorization: Basic {auth_str}\r\n" +
249-
'\r\n'.join(headers)
248+
f"Authorization: Basic {auth_str}" +
249+
'\r\n'.join(headers) + "\r\n"
250250
)
251251
del auth_str
252252
collect()
@@ -378,7 +378,7 @@ def get_status(self) -> GameStatus:
378378
if self.v:
379379
print("Getting status...")
380380
resp = self.request('GET', '/status',
381-
headers=['User-Agent: CircuitPython, dude!']
381+
headers=['User-Agent: CircuitPythonDude']
382382
)
383383
resp_json = loads(resp[1])
384384
if self.v:
@@ -393,7 +393,7 @@ def post(self, point: DataPoint) -> bool:
393393
'/data',
394394
point.dumps(),
395395
content_type = 'application/json',
396-
headers=['User-Agent: CircuitPython, dude!']
396+
headers=['User-Agent: CircuitPythonDude']
397397
).code == 201
398398

399399
def email(self, msg: Email) -> bool:
@@ -404,7 +404,7 @@ def email(self, msg: Email) -> bool:
404404
'/email',
405405
msg.dumps(),
406406
content_type = 'application/json',
407-
headers=['User-Agent: CircuitPython, dude!']
407+
headers=['User-Agent: CircuitPythonDude']
408408
).code == 201
409409

410410
def code_update(self, reset=True) -> bool:
@@ -421,7 +421,7 @@ def code_update(self, reset=True) -> bool:
421421
response = self.request(
422422
'GET',
423423
'/update',
424-
headers=['User-Agent: CircuitPython, dude!']
424+
headers=['User-Agent: CircuitPythonDude']
425425
)
426426
if response.code != 200:
427427
if self.v:

0 commit comments

Comments
 (0)