title: EOF error causing termination when handled in using http.Client.Get method and Body.Read() method
body: <p>I am using an http client to get a json body, and read it to a byte array like</p>
  
  <pre><code>client := new(http.Client)
  client.Timeout = time.Second * 10
  GetJobJson, err := client.Get(joblocation.String()) //where joblocation is of type *url.Url
  if err != nil {
      errorlog.Err.Println("Error getting job from", joblocation.String(), err)
      return false, http.StatusBadRequest, nil
  }
  buff := make([]byte, GetJobJson.ContentLength)
  length, err := GetJobJson.Body.Read(buff) //This returns an EOF error
  if err != nil {
      errorlog.Err.Println("Error reading request body of length", length, "vs contentlength", GetJobJson.ContentLength, err)
      return false, http.StatusBadRequest, nil
  }
  </code></pre>
  
  <p>In the above code, <code>GetJobJson.Body</code> is of type <code>io.ReadCloser</code>, which implements <code>Reader</code>, having <code>Read</code> method, which I am using here as </p>
  
  <pre><code>length, err := GetJobJson.Body.Read(buff) 
  </code></pre>
  
  <p>But since I am handling error here, it is returning an error which says EOF. </p>
  
  <p>The http endpoint to where I am sending the request is running an apache server, mentioning it here since I am not sure if it matters.</p>
  
  <p>If I am not handling the error, I get the complete json body, which is there in the remote server, and the program continues to work as expected. </p>
  
  <p>What is the best way to handle this? Is the <code>Read</code> method that I use, is bad for this situation?</p>