slack icon indicating copy to clipboard operation
slack copied to clipboard

Allow mocking requests to GetOAuth* methods

Open vibridi opened this issue 5 years ago • 0 comments

In version v0.4.0 I used to be able to mock requests to GetOAuth* methods by overriding the SLACK_API variable: slack.SLACK_API = "some-test-url"

Now this isn't possible anymore, because these methods build the request with APIURL which is a constant:

// GetOAuthResponseContext retrieves OAuth response with custom context
func GetOAuthResponseContext(...) (resp *OAuthResponse, err error) {
        ...
	if err = postForm(ctx, client, APIURL+"oauth.access", ...); err != nil {
	...
}

Please would you consider adding back some support for overriding the url? Alternatively, is there a better way to test this?

Thank you

vibridi avatar Jun 10 '20 12:06 vibridi