1
- // INTEL CONFIDENTIAL
2
- // Copyright (C) 2023 Intel Corporation
3
1
package common
4
2
5
3
import (
@@ -14,8 +12,7 @@ import (
14
12
15
13
// MakeGetAPICall :
16
14
func MakeGetAPICall (ctx context.Context , connURL , auth string , payload []byte ) (int , []byte , error ) {
17
- // logger := log.FromContext(ctx).WithName("common.MakeGetAPICall")
18
- // http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: false}
15
+
19
16
req , err := http .NewRequest ("GET" , connURL , bytes .NewBuffer (payload ))
20
17
if err != nil {
21
18
return http .StatusInternalServerError , nil , err
@@ -44,14 +41,12 @@ func MakeGetAPICall(ctx context.Context, connURL, auth string, payload []byte) (
44
41
retcode = resp .StatusCode
45
42
break
46
43
}
47
- // body = []byte(sampleFilesystemList)
48
44
return retcode , body , nil
49
45
}
50
46
51
47
// MakePOSTAPICall :
52
48
func MakePOSTAPICall (ctx context.Context , connURL , auth string , payload []byte ) (int , []byte , error ) {
53
49
54
- // http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: false}
55
50
req , err := http .NewRequest ("POST" , connURL , bytes .NewBuffer (payload ))
56
51
if err != nil {
57
52
return http .StatusInternalServerError , nil , err
@@ -119,8 +114,6 @@ func MakeDeleteAPICall(ctx context.Context, connURL string, auth string, payload
119
114
120
115
// MakePutAPICall :
121
116
func MakePutAPICall (ctx context.Context , connURL , auth string , payload []byte ) (int , []byte , error ) {
122
- // logger := log.FromContext(ctx).WithName("common.MakeGetAPICall")
123
- // http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: false}
124
117
req , err := http .NewRequest ("PUT" , connURL , bytes .NewBuffer (payload ))
125
118
if err != nil {
126
119
return http .StatusInternalServerError , nil , err
@@ -149,13 +142,11 @@ func MakePutAPICall(ctx context.Context, connURL, auth string, payload []byte) (
149
142
retcode = resp .StatusCode
150
143
break
151
144
}
152
- // body = []byte(sampleFilesystemList)
153
145
return retcode , body , nil
154
146
}
155
147
156
148
func printRequest (req * http.Request ) {
157
149
fmt .Printf ("Method: %s\n URL: %s\n Headers: %v\n " , req .Method , req .URL .String (), req .Header )
158
- //fmt.Printf("nHeaders: %v\n", req.Header)
159
150
160
151
if req .Body != nil {
161
152
bodyBytes , _ := io .ReadAll (req .Body )
0 commit comments