adding more server/client communication commands, need to fix echo path params
This commit is contained in:
		@@ -8,21 +8,16 @@ import (
 | 
			
		||||
 | 
			
		||||
// GetServerInfo queries the supplied connection string for server info and uses the provided repoName to get repo specific information
 | 
			
		||||
func GetServerInfo(connectionString string, repoName string) error {
 | 
			
		||||
	serverURL := connectionString + "/info/" //creating the full string to get info
 | 
			
		||||
	client := resty.New()
 | 
			
		||||
	resp, err := client.R().
 | 
			
		||||
		SetPathParams(map[string]string{
 | 
			
		||||
			"repoName": repoName,
 | 
			
		||||
		}).
 | 
			
		||||
		Get(serverURL + "{repoName}")
 | 
			
		||||
	resp, err := client.R().Get(connectionString + "/info") //creating the full string to get info
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("error connecting to server at: %s: error was: %s", serverURL, err)
 | 
			
		||||
		return fmt.Errorf("error connecting to server at: %s: error was: %s", connectionString, err)
 | 
			
		||||
	}
 | 
			
		||||
	if resp.IsError() {
 | 
			
		||||
		if resp.StatusCode() == 404 {
 | 
			
		||||
			return fmt.Errorf("error: repo was not found on server, 404: %s", resp.Request.URL)
 | 
			
		||||
		}
 | 
			
		||||
		return fmt.Errorf("reponse not a success: %d: connection URL: %s", resp.StatusCode(), resp.Request.URL)
 | 
			
		||||
		return fmt.Errorf("response not a success: %d: connection URL: %s", resp.StatusCode(), resp.Request.URL)
 | 
			
		||||
	}
 | 
			
		||||
	fmt.Println(resp)
 | 
			
		||||
	return nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user