mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-25 13:45:52 +03:00
[PR #39] [MERGED] Update uploadFileContent for Python client #290
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#290
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/fsouza/fake-gcs-server/pull/39
Author: @jwhitlock
Created: 6/11/2019
Status: ✅ Merged
Merged: 6/13/2019
Merged by: @fsouza
Base:
master← Head:parse-multipart-range📝 Commits (2)
e1c425fUpdate uploadFileContent for Python client438aec5Run TestParseContentRange in parallel📊 Changes
2 files changed (+152 additions, -21 deletions)
View changed files
📝
fakestorage/upload.go(+97 -21)📝
fakestorage/upload_test.go(+55 -0)📄 Description
This updates
uploadFileContentto handle the needs of both the Go and Python clients when uploading over multiple requests. It rewritesparseRangeasparseContentRange, to parse the header content and leave interpretation and setting response headers touploadFileContent.The Go client always sends content as one or more chunks without a total size, and, when the stream is exhausted, sends a final request with no content but the final size.
The Go client also sends the header
X-Guploader-No-308. This specifies that the response to a "mid-stream" request should be sent with a status code200 OKplus the headerX-Http-Status-Code-Override: 308.The Python client sends chunks with a total size when known, such as when uploading a file or an in-memory string. Unlike a streaming response, the final request contains content. and the final request contains data. It expects a mid-stream response to have a status code
308 Permanent Redirect.The Python client is pickier about some response details, and
uploadFileContent's responses are changed to work with both the Python and (more flexible) Go clients:Rangeresponse header to start counting at 0, such asbytes 0-999, while the Go client appears to ignore the start byte.200 OK, while the Go client accepts this or a201 Created.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.