// body func reads the response body and return it as a string
767056
func body(response *http.Response) (string, error) {

	// if we recived the content we expected
	if strings.Contains(response.Header.Get("Content-Type"), "application/soap+xml") {
		body, err := ioutil.ReadAll(response.Body)
		defer func() {
			// defer can modify the returned value before
			// it is actually passed to the calling statement
			if errClose := response.Body.Close(); errClose != nil && err == nil {
				err = errClose
			}
		}()
		if err != nil {
			return "", fmt.Errorf("error while reading request body %s", err)
		}

		return string(body), nil
	}

	return "", fmt.Errorf("invalid content type")
}
170042
func ReadResponseBody(response *http.Response) ([]byte, error) {
	defer response.Body.Close()
	return ioutil.ReadAll(response.Body)
}
415839
func (i *Issue) GetBody() string {
	if i == nil || i.Body == nil {
		return ""
	}
	return *i.Body
}
763279
func ReadBody(body io.ReadCloser) string {
	buf := new(bytes.Buffer)
	buf.ReadFrom(body)
	return buf.String()
}
500318
func decodeBody(resp *http.Response, out interface{}) error {

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return err
	}

	// Unmarshal the XML.
	if err = xml.Unmarshal(body, &out); err != nil {
		return err
	}

	return nil
}
1121986
func (s *FieldCapsService) BodyString(body string) *FieldCapsService {
	s.bodyString = body
	return s
}
444329
func (r *Response) Body(body io.Reader) *Response {
	r.BodyBuffer, r.Error = ioutil.ReadAll(body)
	return r
}
933950
func (c *Context) Body() []byte {
	body, _ := ioutil.ReadAll(c.Request().Body)
	return body
}
84372
func (req *Request) GetBody() (body io.Reader) {
	body, _ = req.GetValue(HTTP_BODY).(io.Reader)
	return
}
436117
func decodeBody(req *http.Request, out interface{}) error {
	dec := json.NewDecoder(req.Body)
	return dec.Decode(&out)
}
1175647
func (c *Client) GetBodyOfHTTPResponse(u *url.URL) ([]byte, error) {
	resp, err := c.GetHTTPResponse(u)
	if err != nil {
		return []byte{}, err
	}
	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	return body, err
}
569146
func (l *License) GetBody() string {
	if l == nil || l.Body == nil {
		return ""
	}
	return *l.Body
}
739460
func (b *UpdateService) body() (interface{}, error) {
	source := make(map[string]interface{})

	if b.script != "" {
		source["script"] = b.script
	}
	if b.scriptId != "" {
		source["script_id"] = b.scriptId
	}
	if b.scriptFile != "" {
		source["script_file"] = b.scriptFile
	}
	if b.scriptLang != "" {
		source["lang"] = b.scriptLang
	}
	if len(b.scriptParams) > 0 {
		source["params"] = b.scriptParams
	}
	if b.scriptedUpsert != nil {
		source["scripted_upsert"] = *b.scriptedUpsert
	}

	if b.upsert != nil {
		source["upsert"] = b.upsert
	}

	if b.doc != nil {
		source["doc"] = b.doc
	}
	if b.docAsUpsert != nil {
		source["doc_as_upsert"] = *b.docAsUpsert
	}
	if b.detectNoop != nil {
		source["detect_noop"] = *b.detectNoop
	}

	return source, nil
}
423123
func (d *DiscussionComment) GetBody() string {
	if d == nil || d.Body == nil {
		return ""
	}
	return *d.Body
}
883410
func GetRequestBody(r *http.Request) ([]byte, error) {
	body, err := ioutil.ReadAll(r.Body)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return body, nil
}
142442
func (s *Sling) Body(body io.Reader) *Sling {
	if body == nil {
		return s
	}
	return s.BodyProvider(bodyProvider{body: body})
}
1013902
func (r *Request) Body(reader io.Reader) *Request {
	r.Use(body.Reader(reader))
	return r
}