title: How can I set Content-MD5 header in Minio SDK for uploading to IBM Cloud Object Storage?
body: <p>I am trying to set the Content-MD5 header when I use Minio Golang SDK to upload a file to S3. I can successfully upload files to AWS without setting Content-MD5, but uploading to IBM Cloud Object Storage fails with the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>ERR: Object write failed, reason: Missing required header for this request: Content-MD5
  </code></pre>
  
  <p>According to the Minio SDK,<br><a href="https://docs.minio.io/docs/golang-client-api-reference#FPutObject" rel="nofollow noreferrer">https://docs.minio.io/docs/golang-client-api-reference#FPutObject</a><br>I use the UserMetadata field in minio.PutObjectOptions to set Content-MD5, but IBM Cloud Object Storage keeps complaining missing MD5, am I doing something wrong in the following code?</p>
  
  <pre class="lang-golang prettyprint-override"><code>func (cloudIO *CloudIO) FWrite(name string) (n int, err error) {
      f, err := os.Open(name)
      if err != nil {
          log.Fatal(err)
      }
      defer f.Close()
  
      h := md5.New()
      if _, err := io.Copy(h, f); err != nil {
          log.Fatal(err)
      }
  
      bytesWritten, err := cloudIO.client.FPutObject(cloudIO.bucket, cloudIO.address,
          name,
          minio.PutObjectOptions{UserMetadata: map[string]string{"Content-MD5": hex.EncodeToString(h.Sum(nil))}})
      return int(bytesWritten), err
  }
  </code></pre>