mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-28 19:31:34 +00:00
rpcclient: expose endpoint (fixes #2912)
This commit is contained in:
parent
1d6e48ee78
commit
3bdb3a87b8
2 changed files with 23 additions and 0 deletions
|
@ -255,3 +255,8 @@ func (c *Client) Ping() error {
|
||||||
func (c *Client) Context() context.Context {
|
func (c *Client) Context() context.Context {
|
||||||
return c.ctx
|
return c.ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Endpoint returns the client endpoint.
|
||||||
|
func (c *Client) Endpoint() string {
|
||||||
|
return c.endpoint.String()
|
||||||
|
}
|
||||||
|
|
18
pkg/rpcclient/client_test.go
Normal file
18
pkg/rpcclient/client_test.go
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package rpcclient
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/url"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestGetEndpoint(t *testing.T) {
|
||||||
|
host := "http://localhost:1234"
|
||||||
|
u, err := url.Parse(host)
|
||||||
|
require.NoError(t, err)
|
||||||
|
client := Client{
|
||||||
|
endpoint: u,
|
||||||
|
}
|
||||||
|
require.Equal(t, host, client.Endpoint())
|
||||||
|
}
|
Loading…
Reference in a new issue