[GH-ISSUE #103] Support http schema? #2170

Closed
opened 2026-03-15 17:51:03 +03:00 by kerem · 4 comments
Owner

Originally created by @bailantaotao on GitHub (Oct 21, 2019).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/103

HI there,

I have started a fake-gcs-server docker container to do unit test.
Then i'm meet some problems about wrong reader host (It should indicate fake-gcs-server, like 127.0.0.1:4443).

I don't want to modify my /etc/hosts, so i try to set env $STORAGE_EMULATOR_HOST in my unit test. The schema will assign to http [LINK] in GCS library when i set the STORAGE_EMULATOR_HOST env. But fake-gcs-server schema is https...XD

So would you like to add a flag to indicate schema is for https or http?
or do you have other suggestion?

Originally created by @bailantaotao on GitHub (Oct 21, 2019). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/103 HI there, I have started a fake-gcs-server docker container to do unit test. Then i'm meet some problems about wrong reader host (It should indicate fake-gcs-server, like `127.0.0.1:4443`). I don't want to modify my `/etc/hosts`, so i try to set env `$STORAGE_EMULATOR_HOST` in my unit test. The schema will assign to `http` [[LINK](https://github.com/googleapis/google-cloud-go/blob/master/storage/storage.go#L117)] in GCS library when i set the `STORAGE_EMULATOR_HOST` env. But fake-gcs-server schema is https...XD So would you like to add a flag to indicate schema is for https or http? or do you have other suggestion?
kerem closed this issue 2026-03-15 17:51:08 +03:00
Author
Owner

@fsouza commented on GitHub (Oct 21, 2019):

Hey @bailantaotao, we can probably introduce an option for that, but may I ask why you're starting this in a container instead of using it as a library for unit tests?

<!-- gh-comment-id:544586289 --> @fsouza commented on GitHub (Oct 21, 2019): Hey @bailantaotao, we can probably introduce an option for that, but may I ask why you're starting this in a container instead of using it as a library for unit tests?
Author
Owner

@bailantaotao commented on GitHub (Oct 25, 2019):

Sorry reply too late,

I have use library as my top option in unit test, thanks!
It's seems to me that this issue can be closed.

<!-- gh-comment-id:546277042 --> @bailantaotao commented on GitHub (Oct 25, 2019): Sorry reply too late, I have use library as my top option in unit test, thanks! It's seems to me that this issue can be closed.
Author
Owner

@cuonglm commented on GitHub (Dec 25, 2019):

@fsouza What need to change to make it support HTTP?

I try using HTTP transport, change StartTLS -> Start, then I always get:

--- FAIL: TestServerClientBucketAttrs (0.00s)
    --- FAIL: TestServerClientBucketAttrs/tcp_listener (0.00s)
        bucket_test.go:30: Get https://storage.googleapis.com/storage/v1/b/some-bucket?alt=json&prettyPrint=false&projection=full: http: server gave HTTP response to HTTPS client
--- FAIL: TestServerClientBucketAttrsAfterCreateBucket (0.00s)
    --- FAIL: TestServerClientBucketAttrsAfterCreateBucket/tcp_listener (0.00s)
        bucket_test.go:54: Get https://storage.googleapis.com/storage/v1/b/best-bucket-ever?alt=json&prettyPrint=false&projection=full: http: server gave HTTP response to HTTPS client
    --- FAIL: TestServerClientBucketAttrsAfterCreateBucket/tcp_listener#01 (0.00s)
        bucket_test.go:54: Get https://storage.googleapis.com/storage/v1/b/best-bucket-ever?alt=json&prettyPrint=false&projection=full: http: server gave HTTP response to HTTPS client
--- FAIL: TestServerClientBucketAttrsAfterCreateBucketByPost (0.00s)
    --- FAIL: TestServerClientBucketAttrsAfterCreateBucketByPost/tcp_listener (0.00s)
        bucket_test.go:78: Post https://storage.googleapis.com/storage/v1/b?alt=json&prettyPrint=false&project=whatever: http: server gave HTTP response to HTTPS client
    --- FAIL: TestServerClientBucketAttrsAfterCreateBucketByPost/tcp_listener#01 (0.00s)
        bucket_test.go:78: Post https://storage.googleapis.com/storage/v1/b?alt=json&prettyPrint=false&project=whatever: http: server gave HTTP response to HTTPS client

I try setting STORAGE_EMULATOR_HOST to force HTTP but no luck, any suggestion?

<!-- gh-comment-id:568925340 --> @cuonglm commented on GitHub (Dec 25, 2019): @fsouza What need to change to make it support HTTP? I try using HTTP transport, change `StartTLS` -> `Start`, then I always get: ``` --- FAIL: TestServerClientBucketAttrs (0.00s) --- FAIL: TestServerClientBucketAttrs/tcp_listener (0.00s) bucket_test.go:30: Get https://storage.googleapis.com/storage/v1/b/some-bucket?alt=json&prettyPrint=false&projection=full: http: server gave HTTP response to HTTPS client --- FAIL: TestServerClientBucketAttrsAfterCreateBucket (0.00s) --- FAIL: TestServerClientBucketAttrsAfterCreateBucket/tcp_listener (0.00s) bucket_test.go:54: Get https://storage.googleapis.com/storage/v1/b/best-bucket-ever?alt=json&prettyPrint=false&projection=full: http: server gave HTTP response to HTTPS client --- FAIL: TestServerClientBucketAttrsAfterCreateBucket/tcp_listener#01 (0.00s) bucket_test.go:54: Get https://storage.googleapis.com/storage/v1/b/best-bucket-ever?alt=json&prettyPrint=false&projection=full: http: server gave HTTP response to HTTPS client --- FAIL: TestServerClientBucketAttrsAfterCreateBucketByPost (0.00s) --- FAIL: TestServerClientBucketAttrsAfterCreateBucketByPost/tcp_listener (0.00s) bucket_test.go:78: Post https://storage.googleapis.com/storage/v1/b?alt=json&prettyPrint=false&project=whatever: http: server gave HTTP response to HTTPS client --- FAIL: TestServerClientBucketAttrsAfterCreateBucketByPost/tcp_listener#01 (0.00s) bucket_test.go:78: Post https://storage.googleapis.com/storage/v1/b?alt=json&prettyPrint=false&project=whatever: http: server gave HTTP response to HTTPS client ``` I try setting `STORAGE_EMULATOR_HOST` to force `HTTP` but no luck, any suggestion?
Author
Owner

@cuonglm commented on GitHub (Dec 26, 2019):

I add HTTP support in https://github.com/fsouza/fake-gcs-server/pull/154

<!-- gh-comment-id:569021293 --> @cuonglm commented on GitHub (Dec 26, 2019): I add HTTP support in https://github.com/fsouza/fake-gcs-server/pull/154
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#2170
No description provided.