diff options
author | Valery Piashchynski <[email protected]> | 2020-11-19 21:34:22 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-19 21:34:22 +0300 |
commit | bc0be9c17220220ae9b40b65e874701edaecd8ce (patch) | |
tree | 6ee032eee330f8bc8824e426bab1846c9479333c /plugins/http/response.go | |
parent | 729c19af8c410a28b7b46c134fd7fe9608cd73b1 (diff) |
Add SSL tests
Diffstat (limited to 'plugins/http/response.go')
-rw-r--r-- | plugins/http/response.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/http/response.go b/plugins/http/response.go index 6b9fad6c..b0023b59 100644 --- a/plugins/http/response.go +++ b/plugins/http/response.go @@ -16,13 +16,13 @@ type Response struct { // Header contains list of response headers. Headers map[string][]string `json:"headers"` - // associated body payload. - body interface{} + // associated Body payload. + Body interface{} } // NewResponse creates new response based on given pool payload. func NewResponse(p roadrunner.Payload) (*Response, error) { - r := &Response{body: p.Body} + r := &Response{Body: p.Body} if err := json.Unmarshal(p.Context, r); err != nil { return nil, err } @@ -52,14 +52,14 @@ func (r *Response) Write(w http.ResponseWriter) error { w.WriteHeader(r.Status) - if data, ok := r.body.([]byte); ok { + if data, ok := r.Body.([]byte); ok { _, err := w.Write(data) if err != nil { return handleWriteError(err) } } - if rc, ok := r.body.(io.Reader); ok { + if rc, ok := r.Body.(io.Reader); ok { if _, err := io.Copy(w, rc); err != nil { return err } @@ -83,7 +83,7 @@ func handlePushHeaders(h map[string][]string) []string { } func handleTrailers(h map[string][]string) { - trailers, ok := h[trailerHeaderKey] + trailers, ok := h[TrailerHeaderKey] if !ok { return } @@ -99,5 +99,5 @@ func handleTrailers(h map[string][]string) { } } - delete(h, trailerHeaderKey) + delete(h, TrailerHeaderKey) } |