diff options
| author | Shulhan <ms@kilabit.info> | 2024-03-08 02:52:16 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2024-03-09 01:10:24 +0700 |
| commit | 29343294a596fd74f6f9cb917c8aac74ccb78094 (patch) | |
| tree | e9286ed53041b973cb6d767325034f30e504e1f5 /lib/http/endpoint_response_example_test.go | |
| parent | 4e35c509a41cecb207bf6f52e7c9a529fa9f71fb (diff) | |
| download | pakakeh.go-29343294a596fd74f6f9cb917c8aac74ccb78094.tar.xz | |
lib/http: refactoring NewServer and NewClient
The NewServer and NewClient now accept non-pointer options, so the
caller unable to modify the options once the server or client has
been created.
Diffstat (limited to 'lib/http/endpoint_response_example_test.go')
| -rw-r--r-- | lib/http/endpoint_response_example_test.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/http/endpoint_response_example_test.go b/lib/http/endpoint_response_example_test.go index 40e9d6d7..2e78c66f 100644 --- a/lib/http/endpoint_response_example_test.go +++ b/lib/http/endpoint_response_example_test.go @@ -18,7 +18,12 @@ func ExampleEndpointResponse() { ID string } - server, err := NewServer(&ServerOptions{ + var ( + server *Server + err error + ) + + server, err = NewServer(ServerOptions{ Address: "127.0.0.1:7016", }) if err != nil { @@ -67,11 +72,13 @@ func ExampleEndpointResponse() { }() time.Sleep(1 * time.Second) - clientOpts := &ClientOptions{ - ServerURL: `http://127.0.0.1:7016`, - } - cl := NewClient(clientOpts) - params := url.Values{} + var ( + clientOpts = ClientOptions{ + ServerURL: `http://127.0.0.1:7016`, + } + cl = NewClient(clientOpts) + params = url.Values{} + ) // Test call endpoint without "id" parameter. _, resBody, err := cl.Get("/", nil, params) //nolint: bodyclose |
