summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-11-26 20:17:31 +0700
committerShulhan <ms@kilabit.info>2023-11-26 21:32:52 +0700
commit65a77e7fbdf4f9eb2dd84cf006f42b08b868151a (patch)
treefd825d7929b41502f3b0789202665d8a0110db46
parent1425ec0b23f24c7f59036b3b3a4afb34f7508e86 (diff)
downloadpakakeh.go-65a77e7fbdf4f9eb2dd84cf006f42b08b868151a.tar.xz
lib/http: update comment on Client.PostJSON and ClientOptions.ServerUrl
-rw-r--r--lib/http/client.go2
-rw-r--r--lib/http/client_options.go5
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/http/client.go b/lib/http/client.go
index 54a5898e..2b231cb8 100644
--- a/lib/http/client.go
+++ b/lib/http/client.go
@@ -334,6 +334,8 @@ func (client *Client) PostFormData(
// PostJSON send the POST request with content type set to "application/json"
// and params encoded automatically to JSON.
+// The params must be a type than can be marshalled with [json.Marshal] or
+// type that implement [json.Marshaler].
func (client *Client) PostJSON(requestPath string, headers http.Header, params interface{}) (
httpRes *http.Response, resBody []byte, err error,
) {
diff --git a/lib/http/client_options.go b/lib/http/client_options.go
index d881ba12..1f40c5bd 100644
--- a/lib/http/client_options.go
+++ b/lib/http/client_options.go
@@ -17,8 +17,9 @@ type ClientOptions struct {
// This field is optional.
Headers http.Header
- // ServerUrl is any path that is static and will never changes during
- // request to server.
+ // ServerUrl define the server address without path, for example
+ // "https://example.com" or "http://10.148.0.12:8080".
+ // This value should not changed during call of client's method.
// This field is required.
ServerUrl string