blob: 3d16b3ac6be9980a084e1b796ebf0cca4ddc08a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package get
import (
"bytes"
"fmt"
"log"
"net/http"
)
// ContentAll retrives all items from the HTTP API within the provided namespace
func ContentAll(namespace string) []byte {
endpoint := "http://0.0.0.0:8080/api/contents?type="
buf := []byte{}
r := bytes.NewReader(buf)
req, err := http.NewRequest(http.MethodGet, endpoint+namespace, r)
if err != nil {
log.Println("Error creating request for reference from:", namespace)
return nil
}
c := http.Client{}
res, err := c.Do(req)
defer res.Body.Close()
fmt.Println(res, string(buf))
return buf
}
|