From 65a77e7fbdf4f9eb2dd84cf006f42b08b868151a Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 26 Nov 2023 20:17:31 +0700 Subject: lib/http: update comment on Client.PostJSON and ClientOptions.ServerUrl --- lib/http/client.go | 2 ++ lib/http/client_options.go | 5 +++-- 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 -- cgit v1.3