We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2498514 commit ea16ed7Copy full SHA for ea16ed7
utils/api.go
@@ -0,0 +1,21 @@
1
+package utils
2
+
3
+import (
4
+ "io"
5
+ "net/http"
6
+)
7
8
+func CallAPIGet(url, token string) ([]byte, error) {
9
+ req, _ := http.NewRequest("GET", url, nil)
10
+ req.Header.Add("Authorization", "Bearer "+token)
11
+ req.Header.Set("Content-Type", "application/json")
12
13
+ client := &http.Client{}
14
+ res, e := client.Do(req)
15
+ if e != nil {
16
+ return []byte(""), e
17
+ }
18
+ body, e := io.ReadAll(res.Body)
19
20
+ return body, e
21
+}
0 commit comments