Skip to content

fix(drive): add streaming download APIs - #217

Open
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/drive-download-stream
Open

fix(drive): add streaming download APIs#217
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/drive-download-stream

Conversation

@Zhang-986

Copy link
Copy Markdown

Summary

  • Add core.RequestStream so successful file download responses can keep resp.Body open instead of preloading the full payload into RawBody.
  • Add DownloadStream for Drive export task, file, and media downloads while keeping existing Download behavior backwards-compatible.
  • Treat 206 Partial Content as a successful download response for range downloads, and continue to read/close non-success bodies for JSON error handling.

Fixes #181.

Test Plan

  • go test ./core ./service/drive/v1 -run 'Test(RequestStreamDoesNotReadSuccessfulDownloadBody|RequestStreamReadsAndClosesErrorBody|DownloadStreamDoesNotBufferResponse)' -count=1
  • go test ./core -count=1
  • go test ./service/drive/v1 -count=1
  • go test ./... -count=1
  • go test -race ./core ./service/drive/v1 -count=1
  • go vet ./core ./service/drive/v1
  • git diff --check

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.

Drive API 下载接口将整个文件缓存到内存中导致 OOM

1 participant