Replaced the return of Call[Method]() by the stored value of the resp.Body
This commit is contained in:
		@@ -82,8 +82,12 @@ func (caller *HTTPCaller) CallGet(url string, subpath string, types ...string) (
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						err = caller.StoreResp(resp)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return io.ReadAll(resp.Body)
 | 
						return caller.LastResults["body"].([]byte), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CallPut calls the DELETE method on the HTTP server
 | 
					// CallPut calls the DELETE method on the HTTP server
 | 
				
			||||||
@@ -93,8 +97,12 @@ func (caller *HTTPCaller) CallDelete(url string, subpath string) ([]byte, error)
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	defer resp.Body.Close()
 | 
						defer resp.Body.Close()
 | 
				
			||||||
	// caller.LastResults = resp
 | 
						err = caller.StoreResp(resp)
 | 
				
			||||||
	return io.ReadAll(resp.Body)
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return caller.LastResults["body"].([]byte), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CallPost calls the POST method on the HTTP server
 | 
					// CallPost calls the POST method on the HTTP server
 | 
				
			||||||
@@ -117,7 +125,8 @@ func (caller *HTTPCaller) CallPost(url string, subpath string, body interface{},
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return io.ReadAll(resp.Body)
 | 
					
 | 
				
			||||||
 | 
						return caller.LastResults["body"].([]byte), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CallPost calls the POST method on the HTTP server
 | 
					// CallPost calls the POST method on the HTTP server
 | 
				
			||||||
@@ -135,7 +144,12 @@ func (caller *HTTPCaller) CallPut(url string, subpath string, body map[string]in
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	defer resp.Body.Close()
 | 
						defer resp.Body.Close()
 | 
				
			||||||
	return io.ReadAll(resp.Body)
 | 
						err = caller.StoreResp(resp)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return caller.LastResults["body"].([]byte), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CallRaw calls the Raw method on the HTTP server
 | 
					// CallRaw calls the Raw method on the HTTP server
 | 
				
			||||||
@@ -192,6 +206,5 @@ func (caller *HTTPCaller) StoreResp(resp *http.Response) error {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	caller.LastResults["body"] = data
 | 
						caller.LastResults["body"] = data
 | 
				
			||||||
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user