Skip to content

Fix upload task response body size - #380

Draft
ffittschen wants to merge 1 commit into
kean:mainfrom
ffittschen:fix/upload-task-response-body-size
Draft

ffittschen wants to merge 1 commit into
kean:mainfrom
ffittschen:fix/upload-task-response-body-size

Conversation

@ffittschen

Copy link
Copy Markdown

This PR fixes responseBodySize staying at -1 for upload tasks. The root cause was LoggerStore setting it for data and download tasks but not for upload tasks. So even with the response body stored, the inspector showed an empty, disabled Response Body cell, "Copy Response" was hidden, and size filters and sorting skipped upload tasks. The fix sets it from the response body, the same way as for data tasks.

Found while working on #378.

How to test

  • Upload with uploadTask(with:from:) and with uploadTask(with:fromFile:) to an endpoint that returns a body. Assert that the task's response size equals the body size, and that the Response Body cell opens.
  • Assert that an empty 204 response stores 0.

LoggerStore sets responseBodySize for data and download tasks, but not
for upload tasks, so it stayed at its initial value of -1 even when the
upload's response body was stored. Set it from the response body, the
same way as for data tasks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant