Skip to content

Commit

Permalink
refactor: customHost only for the GET request #111
Browse files Browse the repository at this point in the history
  • Loading branch information
saltbo committed Jul 8, 2021
1 parent 78156c0 commit 49f00a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func New(conf Config) (Provider, error) {
conf.Region = "auto"
}

if !strings.Contains(conf.CustomHost, "://") {
conf.CustomHost = "http://" + conf.CustomHost
}

constructor, ok := supportProviders[strings.ToUpper(conf.Provider)]
if !ok {
return nil, fmt.Errorf("provider %s not found", conf.Provider)
Expand Down
4 changes: 4 additions & 0 deletions internal/pkg/provider/provider_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func newS3Provider(conf Config) (*S3Provider, error) {
}

client.Handlers.Build.PushBack(func(r *request.Request) {
if r.HTTPRequest.Method != http.MethodGet {
return
}

r.HTTPRequest.URL.Scheme = cURL.Scheme
r.HTTPRequest.URL.Host = cURL.Host
})
Expand Down

0 comments on commit 49f00a8

Please sign in to comment.