Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make API endpoints return the correct status code when returning an error #13

Closed
QuantumToasted opened this issue Apr 15, 2023 · 2 comments

Comments

@QuantumToasted
Copy link

Hi,

I am using this library with the Estranged.Lfs.Api and Estranged.Lfs.Authenticator.GitHub addons.

Not sure if this is an issue on my end, but looking at source code and other examples, I have built my own IBlobAdapter, which will return errors in certain circumstances. Testing this in Postman locally, my error object is populated and code is set, but the status code returned by the server is still 200 OK. It would be nice to set the status code in the response when handled internally by the library, as as far as I'm aware I do not have control over this.
image

@alanedwardes
Copy link
Owner

Hi Daniel,

This is part of the Git LFS spec: https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md

If there are problems accessing individual objects, servers should continue to return a 200 status code, and provide per-object errors. Here is an example:

That’s because it’s a batch response, and the response could be partial. If this library did anything different, LFS clients would break as it’s no longer following the spec.

Alan

@QuantumToasted
Copy link
Author

Makes sense, I forgot about that quirk of the API spec - that it supports actually processing multiple files at the same time. Thanks!

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

No branches or pull requests

2 participants