Closed Enrico204 closed 3 years ago
Thanks! The patch looks good, but the tests need to be updated, because they check for a 400.
To fix all tests, I had to:
TestAbortedRequest
function: now the function is using a "plausible" and declared error. The reason behind this change is because the h.internalServerError
was crashing the server (due to panic()
and PanicOnError == true
) on stream reading error. Now the code detects whether the error is a network-related error (like unexpected EOF) and it use the correct HTTP status (400 Bad Request). Relevant change:
Tests should be OK. I also added some comments to clarify each if
branch :-)
What is the purpose of this change? What does it change?
This pull request will change the current behavior on disk-related errors:
Previously both were 400 "Bad request"
Was the change discussed in an issue or in the forum before?
Issue: https://github.com/restic/rest-server/issues/155
Checklist
changelog/unreleased/
that describes the changes for our users (template here)gofmt
on the code in all commits