diff options
Diffstat (limited to 'vendor/github.com/SevereCloud/vksdk/v2/api/api.go')
-rw-r--r-- | vendor/github.com/SevereCloud/vksdk/v2/api/api.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/github.com/SevereCloud/vksdk/v2/api/api.go b/vendor/github.com/SevereCloud/vksdk/v2/api/api.go index dfc4afaf..c1fb3dea 100644 --- a/vendor/github.com/SevereCloud/vksdk/v2/api/api.go +++ b/vendor/github.com/SevereCloud/vksdk/v2/api/api.go @@ -203,10 +203,13 @@ func buildQuery(sliceParams ...Params) (context.Context, url.Values) { for _, params := range sliceParams { for key, value := range params { - if key != ":context" { - query.Set(key, FmtValue(value, 0)) - } else { + switch key { + case "access_token": + continue + case ":context": ctx = value.(context.Context) + default: + query.Set(key, FmtValue(value, 0)) } } } @@ -255,6 +258,9 @@ func (vk *VK) DefaultHandler(method string, sliceParams ...Params) (Response, er acceptEncoding = "zstd" } + token := sliceParams[len(sliceParams)-1]["access_token"].(string) + req.Header.Set("Authorization", "Bearer "+token) + req.Header.Set("User-Agent", vk.UserAgent) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") |