Don't set stream unless its true

This commit is contained in:
Asim Aslam 2019-11-09 10:32:52 +00:00
parent 0b1e6d7eaf
commit a9e8fc6039
2 changed files with 19 additions and 8 deletions

View File

@ -95,14 +95,20 @@ func extractEndpoint(method reflect.Method) *registry.Endpoint {
request := extractValue(reqType, 0)
response := extractValue(rspType, 0)
return &registry.Endpoint{
ep := &registry.Endpoint{
Name: method.Name,
Request: request,
Response: response,
Metadata: map[string]string{
"stream": fmt.Sprintf("%v", stream),
},
}
// set endpoint metadata for stream
if stream {
ep.Metadata = map[string]string{
"stream": fmt.Sprintf("%v", stream),
}
}
return ep
}
func extractSubValue(typ reflect.Type) *registry.Value {

View File

@ -90,14 +90,19 @@ func extractEndpoint(method reflect.Method) *registry.Endpoint {
request := extractValue(reqType, 0)
response := extractValue(rspType, 0)
return &registry.Endpoint{
ep := &registry.Endpoint{
Name: method.Name,
Request: request,
Response: response,
Metadata: map[string]string{
"stream": fmt.Sprintf("%v", stream),
},
}
if stream {
ep.Metadata = map[string]string{
"stream": fmt.Sprintf("%v", stream),
}
}
return ep
}
func extractSubValue(typ reflect.Type) *registry.Value {