summaryrefslogtreecommitdiff
path: root/service/http/request.go
diff options
context:
space:
mode:
Diffstat (limited to 'service/http/request.go')
-rw-r--r--service/http/request.go16
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() {