mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
JSON protocol updating (#426)
* JSON protocol updating this patch adds HTTP query string into payload (see more TODOs in code) adds one more test to verify query * Fixing FMT
This commit is contained in:
@@ -33,6 +33,8 @@ func writeString(err error, dst io.Writer, str string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO(xxx): headers, query parameters, body - what else should we add to func's payload?
|
||||
// TODO(xxx): get rid of request body buffering somehow
|
||||
func (h *JSONProtocol) DumpJSON(req *http.Request) error {
|
||||
stdin := json.NewEncoder(h.in)
|
||||
bb := new(bytes.Buffer)
|
||||
@@ -52,6 +54,12 @@ func (h *JSONProtocol) DumpJSON(req *http.Request) error {
|
||||
return err
|
||||
}
|
||||
err = stdin.Encode(req.Header)
|
||||
err = writeString(err, h.in, ",")
|
||||
err = writeString(err, h.in, `"query_parameters":`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = stdin.Encode(req.URL.RawQuery)
|
||||
err = writeString(err, h.in, "}")
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user