code: func HandleResponse(c *Client, resp *http.Response, pretty bool) {
  	defer resp.Body.Close()
  	body, err := ioutil.ReadAll(resp.Body)
  	if err != nil {
  		fmt.Fprintf(os.Stderr, "failed to read body: %s", err)
  		os.Exit(-1)
  	}
  	if resp.StatusCode < 200 || resp.StatusCode > 299 {
  		// Let user know if something went wrong
  		var sbody string
  		if len(body) > 0 {
  			sbody = ": " + string(body)
  		}
  		fmt.Printf("error: %d%s", resp.StatusCode, sbody)
  	} else if !c.Dump && len(body) > 0 {
  		var out string
  		if pretty {
  			var jbody interface{}
  			err = json.Unmarshal(body, &jbody)
  			if err != nil {
  				out = string(body)
  			} else {
  				var b []byte
  				b, err = json.MarshalIndent(jbody, "", "    ")
  				if err == nil {
  					out = string(b)
  				} else {
  					out = string(body)
  				}
  			}
  		} else {
  			out = string(body)
  		}
  		fmt.Print(out)
  	}
  
  	// Figure out exit code
  	exitStatus := 0
  	switch {
  	case resp.StatusCode == 401:
  		exitStatus = 1
  	case resp.StatusCode == 403:
  		exitStatus = 3
  	case resp.StatusCode == 404:
  		exitStatus = 4
  	case resp.StatusCode > 399 && resp.StatusCode < 500:
  		exitStatus = 2
  	case resp.StatusCode > 499:
  		exitStatus = 5
  	}
  	os.Exit(exitStatus)
  }
docs: // HandleResponse logs the response details and exits the process with a status computed from
  // the response status code. The mapping of response status code to exit status is as follows:
  //
  //    401: 1
  //    402 to 500 (other than 403 and 404): 2
  //    403: 3
  //    404: 4
  //    500+: 5