You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use mocha to mock a .tar.gz artifact download, but the binary response body is corrupted.
The error occur because the Scanner used to write the mocked body, because "Successive calls to the Scanner.Scan method will step through the 'tokens' of a file, skipping the bytes between the tokens.", and it causes an error when I try to read the file.
The error occurs because of a behavior of the bufio.Scanner used to write the mocked body into the response. The library doc says that "successive calls to the Scanner.Scan method will step through the 'tokens' of a file, skipping the bytes between the tokens" and, as the default token is a \n character, causes the corruption
Describe the bug
I'm trying to use mocha to mock a
.tar.gz
artifact download, but the binary response body is corrupted.The error occur because the Scanner used to write the mocked body, because "Successive calls to the Scanner.Scan method will step through the 'tokens' of a file, skipping the bytes between the tokens.", and it causes an error when I try to read the file.
The error occurs because of a behavior of the bufio.Scanner used to write the mocked body into the response. The library doc says that "successive calls to the
Scanner.Scan
method will step through the 'tokens' of a file, skipping the bytes between the tokens" and, as the default token is a\n
character, causes the corruptionI'm using github.com/vitorsalgado/mocha/v3 v3.0.2
To Reproduce
Expected behavior
I expect that the response body be equal to the configured body.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: