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

lfs: add missing Accept header to Batch API request #302

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

sisp
Copy link
Collaborator

@sisp sisp commented Jan 16, 2024

I've fixed the Batch API request header to include Accept: application/vnd.git-lfs+json as stated in the spec:

All Batch API requests use the POST verb, and require the following HTTP headers. The request and response bodies are JSON.

Accept: application/vnd.git-lfs+json
Content-Type: application/vnd.git-lfs+json

For instance, omitting this header leads to an error when fetching LFS objects from github.com:

$ dvc import https://github.com/githubschool/lfs-example TogglDesktop-7_4_373.dmg
Importing 'TogglDesktop-7_4_373.dmg (https://github.com/githubschool/lfs-example)' -> 'TogglDesktop-7_4_373.dmg'
...
Could not open LFS object, falling back to raw pointer
...

github.com responds to the Batch API request with HTTP status code 406 and the following response body:

{"message":"Not Acceptable","documentation_url":"https://support.github.com/contact"}

When the Accept header is included, it works fine.

@pmrowla pmrowla self-requested a review January 16, 2024 08:34
@pmrowla pmrowla self-assigned this Jan 16, 2024
@pmrowla pmrowla merged commit feecd19 into iterative:main Jan 23, 2024
11 of 13 checks passed
@sisp sisp deleted the fix/lfs-accept-header branch January 23, 2024 08:02
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.

2 participants