Skip to content

Commit 3b8620b

Browse files
committed
Add httpmethod package and update method usage
1 parent 101d68b commit 3b8620b

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

httpclient/httpclient_request.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/deploymenttheory/go-api-http-client/authenticationhandler"
1111
"github.com/deploymenttheory/go-api-http-client/headers"
12+
"github.com/deploymenttheory/go-api-http-client/httpmethod"
1213
"github.com/deploymenttheory/go-api-http-client/logger"
1314
"github.com/deploymenttheory/go-api-http-client/ratehandler"
1415
"github.com/deploymenttheory/go-api-http-client/status"
@@ -65,9 +66,9 @@ import (
6566
func (c *Client) DoRequest(method, endpoint string, body, out interface{}) (*http.Response, error) {
6667
log := c.Logger
6768

68-
if method.IsIdempotentHTTPMethod(method) {
69+
if httpmethod.IsIdempotentHTTPMethod(method) {
6970
return c.executeRequestWithRetries(method, endpoint, body, out)
70-
} else if method.IsNonIdempotentHTTPMethod(method) {
71+
} else if httpmethod.IsNonIdempotentHTTPMethod(method) {
7172
return c.executeRequest(method, endpoint, body, out)
7273
} else {
7374
return nil, log.Error("HTTP method not supported", zap.String("method", method))
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// method/httpmethod.go
2-
package method
1+
// httpmethod/httpmethod.go
2+
package httpmethod
33

44
/* Ref: https://www.rfc-editor.org/rfc/rfc7231#section-8.1.3
55
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// method/httpmethod_test.go
2-
package method
1+
// httpmethod/httpmethod_test.go
2+
package httpmethod
33

44
import (
55
"net/http"

0 commit comments

Comments
 (0)