title: Youtube Thumbnail upload Failing with API
body: <p>I am trying to upload a thumbnail for youtube video in this way:</p>
  <pre><code>
  import (
      &quot;bufio&quot;
      &quot;fmt&quot;
      &quot;io/ioutil&quot;
      &quot;log&quot;
      &quot;net/http&quot;
      &quot;os&quot;
  )
  
  func main() {
  
      url := &quot;https://www.googleapis.com/youtube/v3/thumbnails/set?videoId=kU7okI-_vvU&amp;key=[API_KEY]Type=media&quot;
      imageRef, err := os.Open(&quot;test.png&quot;)
      if err != nil {
          log.Fatal(&quot;os.Open&quot;, err)
      }
      rd := bufio.NewReader(imageRef)
  
      req, err := http.NewRequest(&quot;POST&quot;, url, rd)
      if err != nil {
          log.Fatal(&quot;http.NewRequest&quot;, err)
      }
  
      log.Println(req.Body)
  
      req.Header.Add(&quot;authorization&quot;, &quot;Bearer [ACCESS_TOKEN]&quot;)
      req.Header.Add(&quot;content-type&quot;, &quot;image/png&quot;)
  
      res, err := http.DefaultClient.Do(req)
      if err != nil {
          log.Fatal(&quot;http.DefaultClient&quot;, err)
      }
  
      defer res.Body.Close()
      body, err := ioutil.ReadAll(res.Body)
      if err != nil {
          log.Fatal(&quot;ioutil.ReadAll&quot;, err)
      }
  
      fmt.Println(res)
      fmt.Println(string(body))
  
  }
  
  </code></pre>
  <p>I am getting this response:</p>
  <pre><code>  &quot;error&quot;: {
      &quot;code&quot;: 400,
      &quot;message&quot;: &quot;The request does not include the image content.&quot;,
      &quot;errors&quot;: [
        {
          &quot;message&quot;: &quot;The request does not include the image content.&quot;,
          &quot;domain&quot;: &quot;youtube.thumbnail&quot;,
          &quot;reason&quot;: &quot;mediaBodyRequired&quot;,
          &quot;location&quot;: &quot;body&quot;,
          &quot;locationType&quot;: &quot;other&quot;
        }
      ]
    }
  }
  </code></pre>
  <p>I am including the image body in the POST request. Yet the respose says <em>&quot;The request does not include the image content.&quot;</em>. Can anyone please help with this.</p>
  <p>API requires that max file size be 2MB and I have ensured this.</p>
  <p>Thank you.</p>
  <p>PS: Although not shown in the code, result is tested with error handling.</p>