get with custom types
This commit is contained in:
		@@ -53,8 +53,16 @@ func NewHTTPCaller(urls map[DataType]map[METHOD]string) *HTTPCaller {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CallGet calls the GET method on the HTTP server
 | 
					// CallGet calls the GET method on the HTTP server
 | 
				
			||||||
func (caller *HTTPCaller) CallGet(url string, subpath string) ([]byte, error) {
 | 
					func (caller *HTTPCaller) CallGet(url string, subpath string, types ...string) ([]byte, error) {
 | 
				
			||||||
	resp, err := http.Get(url + subpath)
 | 
						req, err := http.NewRequest(http.MethodGet, url+subpath, bytes.NewBuffer([]byte("")))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						for _, t := range types {
 | 
				
			||||||
 | 
							req.Header.Set("Content-Type", t)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						client := &http.Client{}
 | 
				
			||||||
 | 
						resp, err := client.Do(req)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user