|
6 | 6 | func wrap{{ .MethodName }}{{ $interceptor.Name }}(endpoint goa.Endpoint, i ServerInterceptors) goa.Endpoint {
|
7 | 7 | return func(ctx context.Context, req any) (any, error) {
|
8 | 8 | {{- if or $interceptor.HasStreamingPayloadAccess $interceptor.HasStreamingResultAccess }}
|
9 |
| - {{- if $interceptor.HasPayloadAccess }} |
10 |
| - info := &{{ $interceptor.Name }}Info{ |
11 |
| - service: "{{ $.Service }}", |
12 |
| - method: "{{ .MethodName }}", |
13 |
| - callType: goa.InterceptorUnary, |
14 |
| - rawPayload: req, |
15 |
| - } |
16 |
| - res, err := i.{{ $interceptor.Name }}(ctx, info, endpoint) |
17 |
| - {{- else }} |
18 |
| - res, err := endpoint(ctx, req) |
19 |
| - {{- end }} |
20 |
| - if err != nil { |
21 |
| - return res, err |
22 |
| - } |
23 |
| - stream := res.({{ .ServerStream.Interface }}) |
24 |
| - return &wrapped{{ .ServerStream.Interface }}{ |
| 9 | + stream := req.(*{{ .ServerStream.EndpointStruct }}).Stream |
| 10 | + req.(*{{ .ServerStream.EndpointStruct }}).Stream = &wrapped{{ .ServerStream.Interface }}{ |
25 | 11 | ctx: ctx,
|
26 | 12 | {{- if $interceptor.HasStreamingResultAccess }}
|
27 | 13 | sendWithContext: func(ctx context.Context, req {{ .ServerStream.SendTypeRef }}) error {
|
@@ -53,7 +39,18 @@ func wrap{{ .MethodName }}{{ $interceptor.Name }}(endpoint goa.Endpoint, i Serve
|
53 | 39 | },
|
54 | 40 | {{- end }}
|
55 | 41 | stream: stream,
|
56 |
| - }, nil |
| 42 | + } |
| 43 | + {{- if $interceptor.HasPayloadAccess }} |
| 44 | + info := &{{ $interceptor.Name }}Info{ |
| 45 | + service: "{{ $.Service }}", |
| 46 | + method: "{{ .MethodName }}", |
| 47 | + callType: goa.InterceptorUnary, |
| 48 | + rawPayload: req, |
| 49 | + } |
| 50 | + return i.{{ $interceptor.Name }}(ctx, info, endpoint) |
| 51 | + {{- else }} |
| 52 | + return endpoint(ctx, req) |
| 53 | + {{- end }} |
57 | 54 | {{- else }}
|
58 | 55 | info := &{{ $interceptor.Name }}Info{
|
59 | 56 | service: "{{ $.Service }}",
|
|
0 commit comments