Feat: add query params
This commit is contained in:
@@ -17,13 +17,15 @@ const (
|
||||
)
|
||||
|
||||
type RequestHeader struct {
|
||||
Method Method `json:"method"`
|
||||
Route string `json:"route"`
|
||||
Method Method `json:"method"`
|
||||
Route string `json:"route"`
|
||||
Params map[string]string `json:"params"`
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
Method Method
|
||||
Route string
|
||||
Params map[string]string
|
||||
|
||||
RemoteAddr string
|
||||
|
||||
@@ -34,6 +36,7 @@ func (self *Request) Header() ([]byte, error) {
|
||||
b, err := json.Marshal(RequestHeader{
|
||||
Method: self.Method,
|
||||
Route: self.Route,
|
||||
Params: self.Params,
|
||||
})
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
@@ -45,6 +48,7 @@ func NewRequest(conn net.Conn, header RequestHeader, body []byte) *Request {
|
||||
return &Request{
|
||||
Method: header.Method,
|
||||
Route: header.Route,
|
||||
Params: header.Params,
|
||||
|
||||
RemoteAddr: conn.RemoteAddr().String(),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user