/*
   Return ETag for "body"
*/
497594
func (this *Response) Etag(body string) string {
	return fmt.Sprint(crc32.ChecksumIEEE([]byte(body)))
}
1325749
func (r *Request) Body(in interface{}) *Request {
	b := new(bytes.Buffer)
	if err := json.NewEncoder(b).Encode(&in); err != nil {
		r.err = err
		return r
	}
	r.body = b
	return r
}
1244010
func (b *CreateIndexService) Body(body string) *CreateIndexService {
	b.bodyString = body
	return b
}
984801
func NewETagConfig() *ETagConfig {
	return &ETagConfig{
		MinBodyLength: 1024,
		EnableMethod: map[string]bool{
			"GET": true,
		},
		EnableStatus: map[int]bool{
			0:             true,
			http.StatusOK: true,
		},
		IgnoreIfHeaderExist: map[string]bool{
			"If-Modified-Since": true,
		},
		IgnoreIfHeaderValue: map[string]string{
			"Upgrade": "websocket",
		},
		HashFunc: func(data []byte) string {
			hash := md5.Sum(data)
			return fmt.Sprintf("%x", hash)
		},
	}
}
926784
func GETBody(ctx log.Interface, server string, strategy auth.Strategy, URI string, headers map[string]string) (io.ReadCloser, error) {
	return performRequestBody(ctx, server, strategy, "GET", URI, headers, nil, MaxRedirects)
}
933597
func (c *CodeOfConduct) GetBody() string {
	if c == nil || c.Body == nil {
		return ""
	}
	return *c.Body
}
1336194
func (r *Response) Body() *String {
	return &String{r.chain, string(r.content)}
}
901635
func (r *Response) BodyString(body string) *Response {
	r.BodyBuffer = []byte(body)
	return r
}
36287
func (s *Secret) Body() string {
	s.Lock()
	defer s.Unlock()

	return s.body
}
11089
func (v *RPC) GetBody() (o []byte) {
	if v != nil && v.Body != nil {
		return v.Body
	}

	return
}
316951
func (s *MultiTermvectorService) BodyString(body string) *MultiTermvectorService {
	s.bodyString = body
	return s
}
1301562
func (s *IndicesShrinkService) BodyString(body string) *IndicesShrinkService {
	s.bodyString = body
	return s
}
110405
func (s *CountService) BodyString(body string) *CountService {
	s.bodyString = body
	return s
}
844167
func getDecryptedETag(headers http.Header, objInfo ObjectInfo, copySource bool) (decryptedETag string) {
	var (
		key [32]byte
		err error
	)
	// If ETag is contentMD5Sum return it as is.
	if len(objInfo.ETag) == 32 {
		return objInfo.ETag
	}

	if crypto.IsMultiPart(objInfo.UserDefined) {
		return objInfo.ETag
	}
	if crypto.SSECopy.IsRequested(headers) {
		key, err = crypto.SSECopy.ParseHTTP(headers)
		if err != nil {
			return objInfo.ETag
		}
	}
	// As per AWS S3 Spec, ETag for SSE-C encrypted objects need not be MD5Sum of the data.
	// Since server side copy with same source and dest just replaces the ETag, we save
	// encrypted content MD5Sum as ETag for both SSE-C and SSE-S3, we standardize the ETag
	//encryption across SSE-C and SSE-S3, and only return last 32 bytes for SSE-C
	if crypto.SSEC.IsEncrypted(objInfo.UserDefined) && !copySource {
		return objInfo.ETag[len(objInfo.ETag)-32:]
	}

	objectEncryptionKey, err := decryptObjectInfo(key[:], objInfo.Bucket, objInfo.Name, objInfo.UserDefined)
	if err != nil {
		return objInfo.ETag
	}
	return tryDecryptETag(objectEncryptionKey, objInfo.ETag, false)
}
449692
func (r *Request) BodyString(body string) *Request {
	r.BodyBuffer = []byte(body)
	return r
}
136075
func (s *IndicesPutSettingsService) BodyString(body string) *IndicesPutSettingsService {
	s.bodyString = body
	return s
}
152922
func (s *PutScriptService) BodyString(body string) *PutScriptService {
	s.bodyString = body
	return s
}