Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
func Test_ApisGetById(t *testing.T) {
apiRequest := &ApiRequest{
Name: "test-" + uuid.NewV4().String(),
Hosts: []string{"example.com"},
Uris: []string{"/example"},
Methods: []string{"GET", "POST"},
UpstreamUrl: "http://localhost:4140/testservice",
StripUri: true,
PreserveHost: true,
Retries: 3,
UpstreamConnectTimeout: 1000,
UpstreamSendTimeout: 2000,
UpstreamReadTimeout: 3000,
HttpsOnly: true,
HttpIfTerminated: true,
}
apiClient := NewClient(NewDefaultConfig()).Apis()
createdApi, err := apiClient.Create(apiRequest)
assert.Nil(t, err)
assert.NotNil(t, createdApi)
result, err := apiClient.GetById(createdApi.Id)
assert.Equal(t, createdApi, result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.