mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-26 06:05:54 +03:00
[PR #35] [MERGED] Add optional custom external URL #284
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#284
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/35
Author: @jwhitlock
Created: 6/5/2019
Status: ✅ Merged
Merged: 6/8/2019
Merged by: @fsouza
Base:
master← Head:custom-external-url📝 Commits (1)
77618f5Add optional custom external URL📊 Changes
2 files changed (+29 additions, -5 deletions)
View changed files
📝
fakestorage/server.go(+16 -5)📝
fakestorage/server_test.go(+13 -0)📄 Description
Add the ability to specify a different base server URL. This would be used by https://github.com/teone/gc-fake-storage to customize the
Locationheader for resumable uploads.When I use the Python client to upload a large file to
gc-fake-storage, it uses the resumable upload endpoint, which is supported byfake-gcs-server🎉 . The raw request, togc-fake-storagerunning in a Docker container calledgcs-emulatoron port 4443, looks something like this:gc-fake-storageserves on0.0.0.0:4443inside the Docker container, and the raw response looks like:[::]is the IPv6 equivalent shorthand for IPv4's0.0.0.0. The Python client attempts toPOSTthe first chunk of the file to theLocationURL, but that is on the requester's container, not thegc-fake-servercontainer, and the request fails.In order for this to work, the
Locationheader would need to be:This PR adds a way to customize what
Server.URL()returns, which can eventually be used ingc-fake-storageto set the external-facing domain for resumable uploads.I also considered dropping the domain name from the resumable upload response, so the
Locationheader looks like:This may also work, but causes tests to fail if done unconditionally. A similar option could be used to drop the domain if requested.
A third option is to use the
Hostfrom the request, but this also breaks tests.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.