mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Removes "type" from json format. Was pointless. (#783)
This commit is contained in:
committed by
Reed Allman
parent
cebae57007
commit
575e1d3d0c
@@ -30,7 +30,6 @@ type CallResponseHTTP struct {
|
|||||||
// jsonIn We're not using this since we're writing JSON directly right now, but trying to keep it current anyways, much easier to read/follow
|
// jsonIn We're not using this since we're writing JSON directly right now, but trying to keep it current anyways, much easier to read/follow
|
||||||
type jsonIn struct {
|
type jsonIn struct {
|
||||||
CallID string `json:"call_id"`
|
CallID string `json:"call_id"`
|
||||||
Type string `json:"type"`
|
|
||||||
Deadline string `json:"deadline"`
|
Deadline string `json:"deadline"`
|
||||||
Body string `json:"body"`
|
Body string `json:"body"`
|
||||||
ContentType string `json:"content_type"`
|
ContentType string `json:"content_type"`
|
||||||
@@ -71,7 +70,6 @@ func (h *JSONProtocol) writeJSONToContainer(ci CallInfo) error {
|
|||||||
Body: body,
|
Body: body,
|
||||||
ContentType: ci.ContentType(),
|
ContentType: ci.ContentType(),
|
||||||
CallID: ci.CallID(),
|
CallID: ci.CallID(),
|
||||||
Type: ci.CallType(),
|
|
||||||
Deadline: ci.Deadline().String(),
|
Deadline: ci.Deadline().String(),
|
||||||
Protocol: CallRequestHTTP{
|
Protocol: CallRequestHTTP{
|
||||||
Type: ci.ProtocolType(),
|
Type: ci.ProtocolType(),
|
||||||
|
|||||||
@@ -80,10 +80,6 @@ func TestJSONProtocolwriteJSONInputRequestBasicFields(t *testing.T) {
|
|||||||
t.Errorf("Request ContentType assertion mismatch: expected: %s, got %s",
|
t.Errorf("Request ContentType assertion mismatch: expected: %s, got %s",
|
||||||
ci.ContentType(), incomingReq.ContentType)
|
ci.ContentType(), incomingReq.ContentType)
|
||||||
}
|
}
|
||||||
if incomingReq.Type != ci.CallType() {
|
|
||||||
t.Errorf("Request CallType assertion mismatch: expected: %s, got %s",
|
|
||||||
ci.CallType(), incomingReq.Type)
|
|
||||||
}
|
|
||||||
if incomingReq.Deadline != ci.Deadline().String() {
|
if incomingReq.Deadline != ci.Deadline().String() {
|
||||||
t.Errorf("Request Deadline assertion mismatch: expected: %s, got %s",
|
t.Errorf("Request Deadline assertion mismatch: expected: %s, got %s",
|
||||||
ci.Deadline(), incomingReq.Deadline)
|
ci.Deadline(), incomingReq.Deadline)
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ Internally functions receive data in the example format below:
|
|||||||
{
|
{
|
||||||
"call_id": "123",
|
"call_id": "123",
|
||||||
"content_type": "application/json",
|
"content_type": "application/json",
|
||||||
"type":"sync",
|
|
||||||
"deadline":"2018-01-30T16:52:39.786Z",
|
"deadline":"2018-01-30T16:52:39.786Z",
|
||||||
"body": "{\"some\":\"input\"}",
|
"body": "{\"some\":\"input\"}",
|
||||||
"protocol": {
|
"protocol": {
|
||||||
@@ -103,9 +102,9 @@ BLANK LINE
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* body - the main contents. If HTTP is the protocol, this would be the request body.
|
||||||
* call_id - the unique ID for the call.
|
* call_id - the unique ID for the call.
|
||||||
* content_type - format of the `body` parameter.
|
* 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.
|
* 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**.
|
* 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**.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user