diff --git a/golang/go_template.go b/golang/go_template.go index 861bf30..562563c 100644 --- a/golang/go_template.go +++ b/golang/go_template.go @@ -173,8 +173,8 @@ func (rc *rpcClient) Exec(ctx context.Context, rpcReq zenrpc.Request) (*zenrpc.R req.Header = rc.header.Clone() req.Header.Add("Content-Type", "application/json") - if xRequestID := ctx.Value("X-Request-ID"); xRequestID.(string) != "" { - req.Header.Add("X-Request-ID",xRequestID.(string)) + if xRequestID, ok := ctx.Value("X-Request-ID").(string); ok && xRequestID != "" { + req.Header.Add("X-Request-ID", xRequestID) } // Do request diff --git a/golang/testdata/catalogue_client.go b/golang/testdata/catalogue_client.go index 2b47b02..7ad9d0f 100755 --- a/golang/testdata/catalogue_client.go +++ b/golang/testdata/catalogue_client.go @@ -536,8 +536,8 @@ func (rc *rpcClient) Exec(ctx context.Context, rpcReq zenrpc.Request) (*zenrpc.R req.Header = rc.header.Clone() req.Header.Add("Content-Type", "application/json") - if xRequestID := ctx.Value("X-Request-ID"); xRequestID.(string) != "" { - req.Header.Add("X-Request-ID", xRequestID.(string)) + if xRequestID, ok := ctx.Value("X-Request-ID").(string); ok && xRequestID != "" { + req.Header.Add("X-Request-ID", xRequestID) } // Do request