go / golang get the response from the POST type method from restful API :    [enter image description here][1]


   [1]: https://i.stack.imgur.com/rVl8N.png


   Quick review refer the enclosed image.

   Concern: How to fetch the json response from the POST method. Note,    
      Currently only able to fetch Status - 401 Unauthorized and StatusCode - 401

       Expected: To fetch the json response {
     "errorMessages": [
      "You do not have the permission to see the specified issue.",
     "Login Required"
     ],
    "errors": {}
    }

    url := "https://www.example.com"
	byt := []byte(`
            {
                "transition":{"id":"2"}						
            }`)
	resp, err := postUrl(url, byt)
	if err != nil {
		log.Fatal(err)
	}
	statusCode := resp.StatusCode
	return statusCode



    func postUrl(url string, byt []byte) (*http.Response, error) {
	tr := &http.Transport{
		DisableCompression: true,
	}
	client := &http.Client{Transport: tr, Timeout: 10 * time.Second}
	req, err := http.NewRequest("POST", url, bytes.NewBuffer(byt))
	req.Header.Set("X-Custom-Header", "myvalue")
	req.Header.Set("Content-Type", "application/json")
	req.Header.Add("Authorization", "Basic "+basicAuth("username", enter  
    code here"password"))
	resp, err := client.Do(req)
	return resp, err

      }

     Above code produce the out put - {
      "errorMessages": [
        "You do not have the permission to see the specified issue.",
        "Login Required"
      ],
       "errors": {}
      }