Skip to content

Commit cef774c

Browse files
committed
add set verify url
1 parent 0b11258 commit cef774c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arcaptcha.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const arcaptchaApi = "https://arcaptcha.co/2/siteverify"
1313
type Website struct {
1414
SiteKey string
1515
SecretKey string
16+
verifyUrl string
1617
}
1718

1819
type verifyReq struct {
@@ -36,9 +37,14 @@ func NewWebsite(siteKey, secretKey string) *Website {
3637
return &Website{
3738
SiteKey: siteKey,
3839
SecretKey: secretKey,
40+
verifyUrl: arcaptchaApi,
3941
}
4042
}
4143

44+
func (w *Website) SetVerifyUrl(url string) {
45+
w.verifyUrl = url
46+
}
47+
4248
// Verify calls arcaptcha verify API and returns result.
4349
//
4450
// if an error occurs while sending or receiving the request, returns error.
@@ -50,7 +56,7 @@ func (w *Website) Verify(response string) (VerifyResp, error) {
5056
Response: response,
5157
}
5258
var resp VerifyResp
53-
err := sendRequest(http.MethodPost, arcaptchaApi, data, &resp)
59+
err := sendRequest(http.MethodPost, w.verifyUrl, data, &resp)
5460
return resp, err
5561
}
5662

0 commit comments

Comments
 (0)