isJSONRPCSSE returns true if the service uses SSE for JSON-RPC streaming. This requires checking the HTTP endpoints in the root expression.
(sd *ServicesData, svc *expr.ServiceExpr)
| 408 | // isJSONRPCSSE returns true if the service uses SSE for JSON-RPC streaming. |
| 409 | // This requires checking the HTTP endpoints in the root expression. |
| 410 | func isJSONRPCSSE(sd *ServicesData, svc *expr.ServiceExpr) bool { |
| 411 | // Check if service has JSON-RPC |
| 412 | httpSvc := sd.Root.API.JSONRPC.HTTPExpr.Service(svc.Name) |
| 413 | if httpSvc == nil { |
| 414 | return false |
| 415 | } |
| 416 | |
| 417 | // Check if any JSON-RPC streaming endpoint uses SSE |
| 418 | for _, e := range httpSvc.HTTPEndpoints { |
| 419 | if e.MethodExpr.IsStreaming() && e.IsJSONRPC() && e.SSE != nil { |
| 420 | return true |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | return false |
| 425 | } |
| 426 | |
| 427 | // streamInterfaceFor builds the data to generate the client and server stream |
| 428 | // interfaces for the given endpoint. |
no test coverage detected