diff options
| author | Shulhan <ms@kilabit.info> | 2021-03-14 22:51:01 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-03-14 22:51:46 +0700 |
| commit | 25fb633ee6ab446917af8dcd2f9b303e85a13c98 (patch) | |
| tree | 7e4b3aff5593498e31270c241e5a749a54f69ca8 /lib/http/endpoint_response_example_test.go | |
| parent | e7552ad0189f761875bc1c2ca3dd716d43a01e0d (diff) | |
| download | pakakeh.go-25fb633ee6ab446917af8dcd2f9b303e85a13c98.tar.xz | |
all: refactoring http.Client methods signature
Previously, parameters to method Delete, Get, Post, PostForm, PostFormData,
PostJSON, Put, and PutJSON are in the following order:
(headers, path, params)
This is sometimes confusing. To make it better and works with format
of HTTP request header,
METHOD PATH
HEADERS
PARAMS
we move the path to the first parameter and headers as the second
parameter, so the call to client methods would be
(path, headers, params)
Diffstat (limited to 'lib/http/endpoint_response_example_test.go')
| -rw-r--r-- | lib/http/endpoint_response_example_test.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/http/endpoint_response_example_test.go b/lib/http/endpoint_response_example_test.go index 3c4fa33c..65780dbb 100644 --- a/lib/http/endpoint_response_example_test.go +++ b/lib/http/endpoint_response_example_test.go @@ -67,7 +67,7 @@ func ExampleEndpointResponse() { params := url.Values{} // Test call endpoint without "id" parameter. - _, resBody, err := cl.Get(nil, "/", params) + _, resBody, err := cl.Get("/", nil, params) if err != nil { log.Fatal(err) } @@ -76,7 +76,7 @@ func ExampleEndpointResponse() { // Test call endpoint with "id" parameter set to "0", it should return // HTTP status 500 with custom message. params.Set("id", "0") - _, resBody, err = cl.Get(nil, "/", params) + _, resBody, err = cl.Get("/", nil, params) if err != nil { log.Fatal(err) } @@ -84,7 +84,7 @@ func ExampleEndpointResponse() { // Test with "id" parameter is set. params.Set("id", "1000") - _, resBody, err = cl.Get(nil, "/", params) + _, resBody, err = cl.Get("/", nil, params) if err != nil { log.Fatal(err) } |
