exoscale / egoscale

exoscale golang bindings
https://pkg.go.dev/github.com/exoscale/egoscale/v3
Apache License 2.0
31 stars 14 forks source link

v2: don't overwrite Host header if host is IP address #561

Closed kobajagi closed 2 years ago

kobajagi commented 2 years ago

This PR prevents endpoint override if endpoint is IP address. This means environment and zone will be ignored in the case of IP address.

Motivation for this PR is to allow running a mock public API server using httptest.

Relevant tests:

$ go test ./... -count=1 -run TestSetEndpointFromContext 
ok      github.com/exoscale/egoscale    0.003s [no tests to run]
?       github.com/exoscale/egoscale/admin      [no test files]
?       github.com/exoscale/egoscale/generate   [no test files]
ok      github.com/exoscale/egoscale/v2 0.003s
ok      github.com/exoscale/egoscale/v2/api     0.002s [no tests to run]
ok      github.com/exoscale/egoscale/v2/oapi    0.003s [no tests to run]
?       github.com/exoscale/egoscale/version    [no test files
shortcut-integration[bot] commented 2 years ago

This pull request has been linked to Shortcut Story #51711: Unit tests for CLI.