code: func inspectResponse(ct string, r io.Reader, clen int64) (string, io.Reader, error) {
  	plen := clen
  	if plen <= 0 || plen > maxPreambleLength {
  		plen = maxPreambleLength
  	}
  
  	preamble := make([]byte, plen)
  	rlen, err := r.Read(preamble)
  	if rlen == 0 {
  		return ct, r, errors.New("empty response")
  	}
  	if err != nil && err != io.EOF {
  		return ct, r, err
  	}
  
  	preambleR := bytes.NewReader(preamble[:rlen])
  	bodyReader := io.MultiReader(preambleR, r)
  	// Some web servers will use application/octet-stream as the default
  	// content type for files without an extension (e.g. 'Dockerfile')
  	// so if we receive this value we better check for text content
  	contentType := ct
  	if len(ct) == 0 || ct == mimeTypes.OctetStream {
  		contentType, _, err = detectContentType(preamble)
  		if err != nil {
  			return contentType, bodyReader, err
  		}
  	}
  
  	contentType = selectAcceptableMIME(contentType)
  	var cterr error
  	if len(contentType) == 0 {
  		cterr = fmt.Errorf("unsupported Content-Type %q", ct)
  		contentType = ct
  	}
  
  	return contentType, bodyReader, cterr
  }
docs: // inspectResponse looks into the http response data at r to determine whether its
  // content-type is on the list of acceptable content types for remote build contexts.
  // This function returns:
  //    - a string representation of the detected content-type
  //    - an io.Reader for the response body
  //    - an error value which will be non-nil either when something goes wrong while
  //      reading bytes from r or when the detected content-type is not acceptable.