func marshalBody(v reflect.Value, p *Params) error {
	// TODO allow body types that aren't necessarily JSON.
	data, err := json.Marshal(v.Addr().Interface())
	if err != nil {
		return errgo.Notef(err, "cannot marshal request body")
	}
	p.Request.Body = BytesReaderCloser{bytes.NewReader(data)}
	p.Request.GetBody = func() (io.ReadCloser, error) { return BytesReaderCloser{bytes.NewReader(data)}, nil }
	p.Request.ContentLength = int64(len(data))
	p.Request.Header.Set("Content-Type", "application/json")
	return nil
}
// marshalBody marshals the specified value into the body of the http request.
marshalBody marshals the specified value into the body of the http request.
// marshalBody marshals the specified value into the body of the http request .
func marshalBody(v reflect.Value, p *Params) error {
	data, err := json.Marshal(v.Addr().Interface())
	if err != nil {
		return errgo.Notef(err, "cannot marshal request body")
	}
	p.Request.Body = BytesReaderCloser{bytes.NewReader(data)}
	p.Request.GetBody = func() (io.ReadCloser, error) { return BytesReaderCloser{bytes.NewReader(data)}, nil }
	p.Request.ContentLength = int64(len(data))
	p.Request.Header.Set("Content-Type", "application/json")
	return nil
}
func marshalBody ( v reflect . Value , p * Params ) error { data , err := json . Marshal ( v . Addr ( ) . Interface ( ) ) if err != nil { return errgo . Notef ( err , " " ) } p . Request . Body = BytesReaderCloser { bytes . NewReader ( data ) } p . Request . GetBody = func ( ) ( io . ReadCloser , error ) { return BytesReaderCloser { bytes . NewReader ( data ) } , nil } p . Request . ContentLength = int64 ( len ( data ) ) p . Request . Header . Set ( " " , " " ) return nil }
marshalBody marshals the specified value into the body of the http request.
marshalBody marshals the specified value into the body of the http request .
// TODO allow body types that aren't necessarily JSON.