Skip to content

Commit

Permalink
Merge pull request #18 from sas1024/master
Browse files Browse the repository at this point in the history
Add JSON-RPC2 notification support for generated go client
  • Loading branch information
sas1024 authored Oct 4, 2022
2 parents 3de8af1 + 10a2384 commit c9fcb8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions golang/go_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ func (c *rpcClient) call(ctx context.Context, methodName string, request, result
// Exec makes http request to jsonrpc endpoint and returns json rpc response.
func (rc *rpcClient) Exec(ctx context.Context, rpcReq zenrpc.Request) (*zenrpc.Response, error) {
if n, ok := ctx.Value("JSONRPC2-Notification").(bool); ok && n {
rpcReq.ID = nil
}
c, err := json.Marshal(rpcReq)
if err != nil {
return nil, fmt.Errorf("json marshal call failed: %w", err)
Expand Down
4 changes: 4 additions & 0 deletions golang/testdata/catalogue_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c9fcb8e

Please sign in to comment.