From a979bbbb5dae624fc549f336fdfd24df477411e8 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Wed, 13 Dec 2017 15:08:43 +0500 Subject: [PATCH] :recycle: More safe using of fasthttp.Args --- create_account.go | 2 +- create_page.go | 2 +- edit_account_info.go | 2 +- edit_page.go | 2 +- get_account_info.go | 2 +- get_page.go | 2 +- get_page_list.go | 2 +- get_views.go | 2 +- revoke_access_token.go | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/create_account.go b/create_account.go index 32a2632..0bf6f17 100644 --- a/create_account.go +++ b/create_account.go @@ -36,7 +36,7 @@ type Account struct { // for each of their channels. On success, returns an Account object with the regular fields and an // additional access_token field. func CreateAccount(account *Account) (*Account, error) { - var args http.Args + args := http.AcquireArgs() // Account name, helps users with several accounts remember which they are // currently using. Displayed to the user above the "Edit/Publish" button diff --git a/create_page.go b/create_page.go index c3eb344..e471da7 100644 --- a/create_page.go +++ b/create_page.go @@ -43,7 +43,7 @@ type Page struct { // CreatePage create a new Telegraph page. On success, returns a Page object. func (account *Account) CreatePage(page *Page, returnContent bool) (*Page, error) { - var args http.Args + args := http.AcquireArgs() // Access token of the Telegraph account. args.Add("access_token", account.AccessToken) // required diff --git a/edit_account_info.go b/edit_account_info.go index 28bc197..07c723f 100644 --- a/edit_account_info.go +++ b/edit_account_info.go @@ -9,7 +9,7 @@ import ( // parameters that you want to edit. On success, returns an Account object // with the default fields. func (account *Account) EditAccountInfo(update *Account) (*Account, error) { - var args http.Args + args := http.AcquireArgs() // Access token of the Telegraph account. args.Add("access_token", account.AccessToken) // required diff --git a/edit_page.go b/edit_page.go index 835e990..b24bce7 100644 --- a/edit_page.go +++ b/edit_page.go @@ -10,7 +10,7 @@ import ( // EditPage edit an existing Telegraph page. On success, returns a Page // object. func (account *Account) EditPage(update *Page, returnContent bool) (*Page, error) { - var args http.Args + args := http.AcquireArgs() // Access token of the Telegraph account. args.Add("access_token", account.AccessToken) // required diff --git a/get_account_info.go b/get_account_info.go index a0af9ad..58c3639 100644 --- a/get_account_info.go +++ b/get_account_info.go @@ -11,7 +11,7 @@ import ( // GetAccountInfo get information about a Telegraph account. Returns an // Account object on success. func (account *Account) GetAccountInfo(fields ...string) (*Account, error) { - var args http.Args + args := http.AcquireArgs() // Access token of the Telegraph account. args.Add("access_token", account.AccessToken) // required diff --git a/get_page.go b/get_page.go index 3ee7694..f93f76e 100644 --- a/get_page.go +++ b/get_page.go @@ -9,7 +9,7 @@ import ( // GetPage get a Telegraph page. Returns a Page object on success. func GetPage(path string, returnContent bool) (*Page, error) { - var args http.Args + args := http.AcquireArgs() // If true, content field will be returned in Page object. args.Add("return_content", strconv.FormatBool(returnContent)) diff --git a/get_page_list.go b/get_page_list.go index ba0beae..794b990 100644 --- a/get_page_list.go +++ b/get_page_list.go @@ -20,7 +20,7 @@ type PageList struct { // GetPageList get a list of pages belonging to a Telegraph account. Returns a PageList object, sorted // by most recently created pages first. func (account *Account) GetPageList(offset, limit int) (*PageList, error) { - var args http.Args + args := http.AcquireArgs() // Access token of the Telegraph account. args.Add("access_token", account.AccessToken) // required diff --git a/get_views.go b/get_views.go index ac86860..4bc4c20 100644 --- a/get_views.go +++ b/get_views.go @@ -16,7 +16,7 @@ type PageViews struct { // GetViews get the number of views for a Telegraph article. By default, the total number of page // views will be returned. Returns a PageViews object on success. func GetViews(path string, hour, day, month, year int) (*PageViews, error) { - var args http.Args + args := http.AcquireArgs() if hour > -1 { // If passed, the number of page views for the requested hour will diff --git a/revoke_access_token.go b/revoke_access_token.go index b114480..15cc6fc 100644 --- a/revoke_access_token.go +++ b/revoke_access_token.go @@ -10,7 +10,7 @@ import ( // to believe the token was compromised. On success, returns an Account object // with new access_token and auth_url fields. func (account *Account) RevokeAccessToken() (*Account, error) { - var args http.Args + args := http.AcquireArgs() // Access token of the Telegraph account. args.Add("access_token", account.AccessToken) // required