initial support for path param

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-01-19 04:12:31 +03:00
parent 7a29127d17
commit d611a6aed5
7 changed files with 202 additions and 93 deletions

View File

@@ -2,10 +2,8 @@ package http
import (
"bufio"
"bytes"
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
"sync"
@@ -65,22 +63,14 @@ func (h *httpStream) Send(msg interface{}) error {
return errShutdown
}
b, err := h.codec.Marshal(msg)
hreq, err := newRequest(h.address, h.request, h.codec, msg, h.opts)
if err != nil {
return err
}
buf := bytes.NewBuffer(b)
req, err := newRequest(h.address, h.request, h.opts)
if err != nil {
return err
}
hreq.Header = h.header
req.Header = h.header
req.Body = ioutil.NopCloser(buf)
req.ContentLength = int64(len(b))
return req.Write(h.conn)
return hreq.Write(h.conn)
}
func (h *httpStream) Recv(msg interface{}) error {