Skip to content

Instantly share code, notes, and snippets.

@kevholditch
Created November 21, 2017 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevholditch/556028624df02caa1d75fa3822d22660 to your computer and use it in GitHub Desktop.
Save kevholditch/556028624df02caa1d75fa3822d22660 to your computer and use it in GitHub Desktop.
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