code: func (c *client) WriteRequest(req *Request) error {
  	if err := c.WriteRequestLine(req.Method, req.Path, req.Query, req.Version.String()); err != nil {
  		return err
  	}
  	for _, h := range req.Headers {
  		if err := c.WriteHeader(h.Key, h.Value); err != nil {
  			return err
  		}
  	}
  	l := req.ContentLength()
  	if l >= 0 {
  		if err := c.WriteHeader("Content-Length", fmt.Sprintf("%d", l)); err != nil {
  			return err
  		}
  	}
  	if req.Body == nil {
  		// doesn't actually start the body, just sends the terminating \r\n
  		return c.StartBody()
  	}
  	// TODO(dfc) Version should implement comparable so we can say version >= HTTP_1_1
  	if req.Version.major == 1 && req.Version.minor == 1 {
  		if l < 0 {
  			if err := c.WriteHeader("Transfer-Encoding", "chunked"); err != nil {
  				return err
  			}
  			if err := c.StartBody(); err != nil {
  				return err
  			}
  			return c.WriteChunked(req.Body)
  		}
  	}
  	if err := c.StartBody(); err != nil {
  		return err
  	}
  	return c.WriteBody(req.Body)
  }
docs: // SendRequest marshalls a HTTP request to the wire.