mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Hot protocols improvements (for 662) (#724)
* Improve deadline handling in streaming protocols * Move special headers handling down to the protocols * Adding function format documentation for JSON changes * Add tests for request url and method in JSON protocol * Fix protocol missing fn-specific info * Fix import * Add panic for something that should never happen
This commit is contained in:
@@ -78,11 +78,6 @@ func FromRequest(appName, path string, req *http.Request) CallOpt {
|
||||
}
|
||||
}
|
||||
|
||||
// add our per call headers in here
|
||||
req.Header.Set("FN_METHOD", req.Method)
|
||||
req.Header.Set("FN_REQUEST_URL", reqURL(req))
|
||||
req.Header.Set("FN_CALL_ID", id)
|
||||
|
||||
// this ensures that there is an image, path, timeouts, memory, etc are valid.
|
||||
// NOTE: this means assign any changes above into route's fields
|
||||
err = route.Validate()
|
||||
@@ -233,16 +228,6 @@ func (a *agent) GetCall(opts ...CallOpt) (Call, error) {
|
||||
c.slotDeadline = slotDeadline
|
||||
c.execDeadline = execDeadline
|
||||
|
||||
execDeadlineStr := strfmt.DateTime(execDeadline).String()
|
||||
|
||||
// these 2 headers buckets are the same but for posterity!
|
||||
if c.Headers == nil {
|
||||
c.Headers = make(http.Header)
|
||||
c.req.Header = c.Headers
|
||||
}
|
||||
c.Headers.Set("FN_DEADLINE", execDeadlineStr)
|
||||
c.req.Header.Set("FN_DEADLINE", execDeadlineStr)
|
||||
|
||||
return &c, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user