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:
Dario Domizioli
2018-01-31 12:26:43 +00:00
committed by GitHub
parent 02c8aa1998
commit e753732bd8
8 changed files with 158 additions and 36 deletions

View File

@@ -84,9 +84,12 @@ Internally functions receive data in the example format below:
{
"call_id": "123",
"content_type": "application/json",
"type":"sync",
"deadline":"2018-01-30T16:52:39.786Z",
"body": "{\"some\":\"input\"}",
"protocol": {
"type": "http",
"method": "POST",
"request_url": "http://localhost:8080/r/myapp/myfunc?q=hi",
"headers": {
"Content-Type": ["application/json"],
@@ -95,13 +98,15 @@ Internally functions receive data in the example format below:
}
}
BLANK LINE
{
{
NEXT INPUT OBJECT
}
```
* call_id - the unique ID for the call.
* content_type - format of the `body` parameter.
* type - whether the call was sync or async.
* deadline - a time limit for the call, based on function timeout.
* protocol - arbitrary map of protocol specific data. The above example shows what the HTTP protocol handler passes in. Subject to change and reduces reusability of your functions. **USE AT YOUR OWN RISK**.
Under `protocol`, `headers` contains all of the HTTP headers exactly as defined in the incoming request.