mirror of
https://github.com/foomo/gotsrpc.git
synced 2025-10-16 12:35:35 +00:00
fix: lint issues
This commit is contained in:
parent
0a3551cb98
commit
06f4516256
@ -35,7 +35,7 @@ Release downloads:
|
||||
|
||||
## How to Contribute
|
||||
|
||||
Make a pull request...
|
||||
Please refer to the [CONTRIBUTING](.gihub/CONTRIBUTING.md) details and follow the [CODE_OF_CONDUCT](.gihub/CODE_OF_CONDUCT.md) and [SECURITY](.github/SECURITY.md) guidelines.
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
HeaderServiceToService = "X-Foomo-S2S"
|
||||
HeaderServiceToService = "X-Foomo-S2s"
|
||||
)
|
||||
|
||||
// ClientTransport to use for calls
|
||||
|
||||
@ -6,20 +6,21 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_newRequest(t *testing.T) {
|
||||
t.Run("custom headers", func(t *testing.T) {
|
||||
headers := http.Header{}
|
||||
headers.Set("test", "test")
|
||||
headers.Set("Test", "test")
|
||||
|
||||
request, err := newRequest(context.Background(), "/test", "text/html", nil, headers)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "test", request.Header.Get("test"))
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "test", request.Header.Get("Test"))
|
||||
})
|
||||
t.Run("default", func(t *testing.T) {
|
||||
request, err := newRequest(context.Background(), "/test", "text/html", nil, nil)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "/test", request.URL.Path)
|
||||
assert.Equal(t, "text/html", request.Header.Get("Accept"))
|
||||
assert.Equal(t, "text/html", request.Header.Get("Content-Type"))
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const sampleConf = `---
|
||||
@ -70,13 +71,13 @@ func TestLoadConfig(t *testing.T) {
|
||||
|
||||
func TestLoadConfigFile_GomodAbsolute(t *testing.T) {
|
||||
config, err := LoadConfigFile("testdata/gomod.absolute.yml")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "/go/src/github.com/foomo/gotsrpc", config.Module.Path)
|
||||
}
|
||||
|
||||
func TestLoadConfigFile_GomodRelative(t *testing.T) {
|
||||
config, err := LoadConfigFile("testdata/gomod.relative.yml")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
fmt.Println(config.Module.Path)
|
||||
assert.True(t, strings.HasSuffix(config.Module.Path, "gotsrpc/config/demo"))
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user