diff --git a/handler/context.go b/handler/context.go index 31cc859..ba56501 100644 --- a/handler/context.go +++ b/handler/context.go @@ -70,6 +70,7 @@ func NewHttpContext(msg *http.ServerMessage) *HttpContext { pathParams: req.PathParams, query: query, headers: headers, + data: req.Body, }, Response: &HttpResponse{ Status: 200, diff --git a/handler/request.go b/handler/request.go index 44b9054..1d523cc 100644 --- a/handler/request.go +++ b/handler/request.go @@ -24,6 +24,7 @@ import ( type HttpRequest interface { Method() string Path() string + Data() []byte Query() map[string][]string Headers() map[string][]string PathParams() map[string]string @@ -32,6 +33,7 @@ type HttpRequest interface { type httpRequestImpl struct { method string path string + data []byte query map[string][]string headers map[string][]string pathParams map[string]string @@ -45,6 +47,10 @@ func (h *httpRequestImpl) Path() string { return h.path } +func (h *httpRequestImpl) Data() []byte { + return h.data +} + func (h *httpRequestImpl) Query() map[string][]string { return h.query }