mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Use valid call type instead in protocol (#534)
This commit is contained in:
committed by
Reed Allman
parent
4cc2b093b0
commit
347edea56e
@@ -64,7 +64,7 @@ func (ci callInfoImpl) Input() io.Reader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ci callInfoImpl) ProtocolType() string {
|
func (ci callInfoImpl) ProtocolType() string {
|
||||||
return "http"
|
return ci.call.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request basically just for the http format, since that's the only that makes sense to have the full request as is
|
// Request basically just for the http format, since that's the only that makes sense to have the full request as is
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ func TestJSONProtocolwriteJSONInputRequestWithData(t *testing.T) {
|
|||||||
rDataBefore := RequestData{A: "a"}
|
rDataBefore := RequestData{A: "a"}
|
||||||
req := setupRequest(rDataBefore)
|
req := setupRequest(rDataBefore)
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
call := &models.Call{}
|
call := &models.Call{Type: "json"}
|
||||||
ci := &callInfoImpl{call, req}
|
ci := &callInfoImpl{call, req}
|
||||||
proto := JSONProtocol{w, r}
|
proto := JSONProtocol{w, r}
|
||||||
go func() {
|
go func() {
|
||||||
@@ -78,12 +78,16 @@ func TestJSONProtocolwriteJSONInputRequestWithData(t *testing.T) {
|
|||||||
t.Errorf("Request data assertion mismatch: expected: %s, got %s",
|
t.Errorf("Request data assertion mismatch: expected: %s, got %s",
|
||||||
rDataBefore.A, rDataAfter.A)
|
rDataBefore.A, rDataAfter.A)
|
||||||
}
|
}
|
||||||
|
if incomingReq.Protocol.Type != call.Type {
|
||||||
|
t.Errorf("Call protocol type assertion mismatch: expected: %s, got %s",
|
||||||
|
call.Type, incomingReq.Protocol.Type)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJSONProtocolwriteJSONInputRequestWithoutData(t *testing.T) {
|
func TestJSONProtocolwriteJSONInputRequestWithoutData(t *testing.T) {
|
||||||
req := setupRequest(nil)
|
req := setupRequest(nil)
|
||||||
|
|
||||||
call := &models.Call{}
|
call := &models.Call{Type: "json"}
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
ci := &callInfoImpl{call, req}
|
ci := &callInfoImpl{call, req}
|
||||||
proto := JSONProtocol{w, r}
|
proto := JSONProtocol{w, r}
|
||||||
@@ -119,7 +123,7 @@ func TestJSONProtocolwriteJSONInputRequestWithQuery(t *testing.T) {
|
|||||||
req := setupRequest(nil)
|
req := setupRequest(nil)
|
||||||
|
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
call := &models.Call{}
|
call := &models.Call{Type: "json"}
|
||||||
ci := &callInfoImpl{call, req}
|
ci := &callInfoImpl{call, req}
|
||||||
proto := JSONProtocol{w, r}
|
proto := JSONProtocol{w, r}
|
||||||
go func() {
|
go func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user