Skip to content

Commit 6b8d4d8

Browse files
fixed square analyzer client error (#3887)
<!-- Please create an issue to collect feedback prior to feature additions. Please also reference that issue in any PRs. If possible try to keep PRs scoped to one feature, and add tests for new features. --> ### Description: Related to issue: #3874 ### Checklist: * [ ] Tests passing (`make test-community`)? * [ ] Lint passing (`make lint` this requires [golangci-lint](https://golangci-lint.run/welcome/install/#local-installation))?
1 parent 03ca8aa commit 6b8d4d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/analyzer/analyzers/square/square.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ type SecretInfo struct {
152152
func getPermissions(cfg *config.Config, key string) (PermissionsJSON, error) {
153153
var permissions PermissionsJSON
154154

155-
client := analyzers.NewAnalyzeClient(cfg)
155+
// POST request is considered as non-safe. Square Post request does not change any state.
156+
// We are using unrestricted client to avoid error for non-safe API request.
157+
client := analyzers.NewAnalyzeClientUnrestricted(cfg)
156158
req, err := http.NewRequest("POST", "https://connect.squareup.com/oauth2/token/status", nil)
157159
if err != nil {
158160
return permissions, err
@@ -183,7 +185,9 @@ func getPermissions(cfg *config.Config, key string) (PermissionsJSON, error) {
183185
func getUsers(cfg *config.Config, key string) (TeamJSON, error) {
184186
var team TeamJSON
185187

186-
client := analyzers.NewAnalyzeClient(cfg)
188+
// POST request is considered as non-safe. Square Post request does not change any state.
189+
// We are using unrestricted client to avoid error for non-safe API request.
190+
client := analyzers.NewAnalyzeClientUnrestricted(cfg)
187191
req, err := http.NewRequest("POST", "https://connect.squareup.com/v2/team-members/search", nil)
188192
if err != nil {
189193
return team, err

0 commit comments

Comments
 (0)