Skip to content

Commit bcc3a94

Browse files
committed
HTTP Response handling
1 parent 8d3a0d8 commit bcc3a94

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

httpclient/http-client.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ type HttpExecution struct {
3434
ResponseBodyOutput io.Writer
3535
}
3636

37+
var validHttpResponse = map[int]bool{
38+
http.StatusOK: true,
39+
http.StatusCreated: true,
40+
http.StatusNoContent: true,
41+
}
42+
3743
func setBasicAuthHeader(request *http.Request, username, password string) {
3844
if cmd.UsernameParam != "" {
3945
username = cmd.UsernameParam
@@ -61,12 +67,6 @@ func createHttpClient(tlsEnabled bool, insecureAllowed bool) *http.Client {
6167
return &client
6268
}
6369

64-
var validHttpResponse = map[int]bool{
65-
http.StatusOK: true,
66-
http.StatusCreated: true,
67-
http.StatusNoContent: true,
68-
}
69-
7070
func checkStatusResponse(httpStatus int) {
7171
if !validHttpResponse[httpStatus] {
7272
fmt.Println("HTTP ERROR", httpStatus, http.StatusText(httpStatus))

0 commit comments

Comments
 (0)