-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add API endpoint to request contents of multiple files simultaniously #34139
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
Conversation
…itea into feat/multiple-files-api
Some thoughts in my mind:
|
|
HTTP QUERY is a proposed standard to solve the GET-with-body problem. Tooling support is probably not there yet, but if it works in your case, it might be an option to use it already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- IIRC, the HTTP spec says or has said that GET requests should not contain a body - that's why it isn't an option. Post is the next best choice I think.
I see, I missed the Files []string
field, it would be quite large so it is POST's job.
@wxiaoguang Added an integration test |
…itea into feat/multiple-files-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…itea into feat/multiple-files-api
Found various legacy (related) problems, need to fix together. If I open a separate refactoring PR, the PRs would conflict largely. So I made the changes in this PR directly. 🙏 |
@wxiaoguang Looks good, I already noticed that the mechanism for getting the ref was flawed. I also missed that base64 encoding increases the size - I adapted the test to it. Could you fix the lint issues in your bugfix? |
One more thing, it's impossible to make "POST" work with "read" permission at the moment, so I also added the "GET" method support. It is somewhat hacky but I think it is the only thing we can do at the moment. |
* giteaofficial/main: [skip ci] Updated translations via Crowdin Display when a release attachment was uploaded (go-gitea#34261) Fix Set Email Preference dropdown and button placement (go-gitea#34255) [skip ci] Updated translations via Crowdin Update compare.tmpl (go-gitea#34251) Make public URL generation configurable (go-gitea#34250) Add API endpoint to request contents of multiple files simultaniously (go-gitea#34139)
Adds an API POST endpoint under
/repos/{owner}/{repo}/file-contents
which receives a list of paths and returns a list of the contents of these files.This API endpoint will be helpful for applications like headless CMS (reference: sveltia/sveltia-cms#198) which need to retrieve a large number of files by reducing the amount of needed API calls.
Close #33495