diff options
author | Wolfy-J <[email protected]> | 2018-07-07 20:14:04 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2018-07-07 20:14:04 -0700 |
commit | ad0562981de801ad32b5bfd48cea9c92793a8cc0 (patch) | |
tree | 2b8ee2778ddf5399a1fe9260c0947bf9a194bf80 /service/http/request.go | |
parent | afde365ba6210569b7d48dec0c07434a7f8a1fd8 (diff) | |
parent | 466383c72d921aba728de40b60910741e561c1d1 (diff) |
Merge pull request #27 from spiral/feature/arguments
Feature/arguments
Diffstat (limited to 'service/http/request.go')
-rw-r--r-- | service/http/request.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/service/http/request.go b/service/http/request.go index 9281a3f5..21566416 100644 --- a/service/http/request.go +++ b/service/http/request.go @@ -44,6 +44,9 @@ type Request struct { // Uploads contains list of uploaded files, their names, sized and associations with temporary files. Uploads *Uploads `json:"uploads"` + // Attributes can be set by chained middleware to safely pass value from Golang to PHP. See: GetAttribute, SetAttribute functions. + Attributes map[string]interface{} `json:"attributes"` + // request body can be parsedData or []byte body interface{} } @@ -51,12 +54,13 @@ type Request struct { // NewRequest creates new PSR7 compatible request using net/http request. func NewRequest(r *http.Request, cfg *UploadsConfig) (req *Request, err error) { req = &Request{ - Protocol: r.Proto, - Method: r.Method, - URI: uri(r), - Headers: r.Header, - Cookies: make(map[string]string), - RawQuery: r.URL.RawQuery, + Protocol: r.Proto, + Method: r.Method, + URI: uri(r), + Headers: r.Header, + Cookies: make(map[string]string), + RawQuery: r.URL.RawQuery, + Attributes: AllAttributes(r), } for _, c := range r.Cookies() { |