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
When calling the RepositoryFilesService.GetFileMetaData() function on a file that doesn't exist, but the request was successful, I expect the returned *File and error to be nil.
Instead I get an ErrorResponse containing HEAD http://127.0.0.1:49996/api/v4/projects/1234/repository/files/foobar.yaml: 404 failed to parse unknown error format.
This is due to the fact that CheckResponse() (called by Client.Do(), called by RepositoryFilesService.GetFileMetaData()) tries to parse the empty body as JSON.
I think it fails here:
data, err := ioutil.ReadAll(r.Body)
if err == nil && data != nil {
data doesn't seem to be nil here, maybe it contains \r\n? As I can see, this endpoint that came with #511 is the only one within the codebase using HEAD, which is probably why it never popped up before.
Nevertheless I think that a HEAD request that returns 404 should either be not an error or some specific error (e.g. NotFoundError) to be catchable.
The text was updated successfully, but these errors were encountered:
When calling the
RepositoryFilesService.GetFileMetaData()
function on a file that doesn't exist, but the request was successful, I expect the returned*File
anderror
to be nil.Instead I get an
ErrorResponse
containingHEAD http://127.0.0.1:49996/api/v4/projects/1234/repository/files/foobar.yaml: 404 failed to parse unknown error format
.This is due to the fact that CheckResponse() (called by Client.Do(), called by RepositoryFilesService.GetFileMetaData()) tries to parse the empty body as JSON.
I think it fails here:
data
doesn't seem to be nil here, maybe it contains\r\n
? As I can see, this endpoint that came with #511 is the only one within the codebase using HEAD, which is probably why it never popped up before.Nevertheless I think that a HEAD request that returns 404 should either be not an error or some specific error (e.g. NotFoundError) to be catchable.
The text was updated successfully, but these errors were encountered: