Skip to content

Commit ec3db04

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents 2e10e66 + 9c31e76 commit ec3db04

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Diff for: simplyprint_duet3d/cli/autodiscover.py

-2
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,10 @@ async def connect_to_duet(address: str, password: str) -> Optional[dict]:
111111
board = board['result']
112112
duet_name = await duet.rr_model(key='network.name')
113113
duet_name = duet_name['result']
114-
115114
try:
116115
webcam_uri = await get_webcam_url(duet)
117116
except aiohttp.client_exceptions.ClientResponseError:
118117
webcam_uri = None
119-
120118
try:
121119
cookie = await get_cookie(duet)
122120
except aiohttp.client_exceptions.ClientResponseError:

Diff for: simplyprint_duet3d/duet/api.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,12 @@ async def rr_upload(
290290

291291
params['crc32'] = '{0:08x}'.format(checksum)
292292

293+
headers = {
294+
'Content-Length': str(len(content)),
295+
}
296+
293297
response = b''
294-
async with self.session.post(url, data=content, params=params) as r:
298+
async with self.session.post(url, data=content, params=params, headers=headers) as r:
295299
response = await r.json()
296300
return response
297301

@@ -341,12 +345,17 @@ async def file_chunk():
341345
total=60 * 30, # 30 minutes
342346
)
343347

348+
headers = {
349+
'Content-Length': str(filesize),
350+
}
351+
344352
response = b''
345353
async with self.session.post(
346354
url=url,
347355
data=file_chunk(),
348356
params=params,
349357
timeout=timeout,
358+
headers=headers,
350359
) as r:
351360
response = await r.json()
352361

Diff for: tests/test_api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async def test_rr_upload(reprapfirmware, mock_session):
8282
content = b'testtttttt'
8383
response = await reprapfirmware.rr_upload('test.txt', content)
8484
assert response == {'err': 0}
85-
mock_session.post.assert_called_once_with('http://10.42.0.2/rr_upload', data=content, params={'name': 'test.txt', 'crc32': '075b1c7c'})
85+
mock_session.post.assert_called_once_with('http://10.42.0.2/rr_upload', data=content, params={'name': 'test.txt', 'crc32': '075b1c7c'}, headers={'Content-Length': '10'})
8686

8787

8888
@pytest.mark.asyncio

0 commit comments

Comments
 (0)