// Set the JSON body for the coming request
976318
func (F *Frisby) SetJson(json interface{}) *Frisby {
	F.Req.Json = json
	return F
}
350587
func (rc *RequestConfig) SetBody(body string) *RequestConfig {
	if len(body) > 0 {
		rc.Body = body
	}

	return rc
}
401182
func ReadJSONBody(r *http.Request, result interface{}) error {
	err := json.NewDecoder(r.Body).Decode(result)
	r.Body.Close()

	if err != nil {
		return err
	}

	return nil
}
1370661
func (r *httpJSONRequest) SetBodyImportArray(bodyArray interface{}) (driver.Request, error) {
	bodyArrayVal := reflect.ValueOf(bodyArray)
	switch bodyArrayVal.Kind() {
	case reflect.Array, reflect.Slice:
		// OK
	default:
		return nil, driver.WithStack(driver.InvalidArgumentError{Message: fmt.Sprintf("bodyArray must be slice, got %s", bodyArrayVal.Kind())})
	}
	// Render elements
	elementCount := bodyArrayVal.Len()
	buf := &bytes.Buffer{}
	encoder := json.NewEncoder(buf)
	for i := 0; i < elementCount; i++ {
		entryVal := bodyArrayVal.Index(i)
		if isNil(entryVal) {
			buf.WriteString("\n")
		} else {
			if err := encoder.Encode(entryVal.Interface()); err != nil {
				return nil, driver.WithStack(err)
			}
		}
	}
	r.body = buf.Bytes()
	return r, nil
}
288149
func (s *TestInvokeMethodOutput) SetBody(v string) *TestInvokeMethodOutput {
	s.Body = &v
	return s
}
723433
func (s *IndicesPutMappingService) BodyJson(mapping map[string]interface{}) *IndicesPutMappingService {
	s.bodyJson = mapping
	return s
}
475590
func (r *Request) setBodyString(body string) error {
	return r.setBodyReader(strings.NewReader(body))
}
823357
func (s *Communication) SetBody(v string) *Communication {
	s.Body = &v
	return s
}
426215
func SetSendGetBodyAs(httpMethod string) ClientOptionFunc {
	return func(c *Client) error {
		c.sendGetBodyAs = httpMethod
		return nil
	}
}
1283332
func (s *Section) SetBody(body string) {
	if !s.isRawSection {
		return
	}
	s.rawBody = body
}
1350740
func (r *vstRequest) SetBody(body ...interface{}) (driver.Request, error) {
	switch len(body) {
	case 0:
		return r, driver.WithStack(fmt.Errorf("Must provide at least 1 body"))
	case 1:
		if data, err := velocypack.Marshal(body[0]); err != nil {
			return r, driver.WithStack(err)
		} else {
			r.body = data
		}
		return r, nil
	default:
		slices := make([]velocypack.Slice, len(body))
		for i, b := range body {
			var err error
			slices[i], err = velocypack.Marshal(b)
			if err != nil {
				return r, driver.WithStack(err)
			}
		}
		merged, err := velocypack.Merge(slices...)
		if err != nil {
			return r, driver.WithStack(err)
		}
		r.body = merged
		return r, nil
	}
}
1148608
func (r Request) SetBody(body io.ReadSeeker) error {
	size, err := body.Seek(0, io.SeekEnd)
	if err != nil {
		return err
	}

	body.Seek(0, io.SeekStart)
	r.ContentLength = size
	r.Header["Content-Length"] = []string{strconv.FormatInt(size, 10)}

	if size != 0 {
		r.Body = &retryableRequestBody{body: body}
		r.GetBody = func() (io.ReadCloser, error) {
			_, err := body.Seek(0, io.SeekStart)
			if err != nil {
				return nil, err
			}
			return r.Body, nil
		}
	} else {
		// in case the body is an empty stream, we need to use http.NoBody to explicitly provide no content
		r.Body = http.NoBody
		r.GetBody = func() (io.ReadCloser, error) {
			return http.NoBody, nil
		}

		// close the user-provided empty body
		if c, ok := body.(io.Closer); ok {
			c.Close()
		}
	}

	return nil
}
866206
func (s *CampaignSmsMessage) SetBody(v string) *CampaignSmsMessage {
	s.Body = &v
	return s
}
1135800
func (rc *RequestConfig) SetJSONInterface(body interface{}) *RequestConfig {
	if b, err := json.Marshal(body); err == nil {
		rc.Body = string(b)
	}

	return rc
}
819300
func (r *Request) JsonBody(instance interface{}) error {
	decoder := json.NewDecoder(r.Body)
	defer r.Body.Close()

	return decoder.Decode(instance)
}
726517
func SetJson(s interface{}) string {
	dat, err := json.Marshal(s)
	if err != nil {
		panic("Set json failed")
	}
	return string(dat)
}
1112808
func (r *httpVPackRequest) SetBodyImportArray(bodyArray interface{}) (driver.Request, error) {
	bodyArrayVal := reflect.ValueOf(bodyArray)
	switch bodyArrayVal.Kind() {
	case reflect.Array, reflect.Slice:
		// OK
	default:
		return nil, driver.WithStack(driver.InvalidArgumentError{Message: fmt.Sprintf("bodyArray must be slice, got %s", bodyArrayVal.Kind())})
	}
	// Render elements
	buf := &bytes.Buffer{}
	encoder := velocypack.NewEncoder(buf)
	if err := encoder.Encode(bodyArray); err != nil {
		return nil, driver.WithStack(err)
	}
	r.body = buf.Bytes()
	r.SetQuery("type", "list")
	return r, nil
}