Skip to content

Commit e0d6134

Browse files
committed
add timeout to README.md
1 parent 3604e0b commit e0d6134

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ website := arcaptcha.NewWebsite("YOUR_SITE_KEY", "YOUR_SECRET_KEY")
2727
//After you put captcha widget in your website, you can get 'arcaptcha-response' from form
2828
result, err := website.Verify("arcaptcha-response")
2929
if err != nil {
30-
// error in sending or receiving API request
31-
// handle error
30+
// error in sending or receiving API request
31+
// handle error
3232
}
3333
if !result.Success {
34-
// captcha not verified
35-
// can see result.ErrorCodes to find what's wrong
36-
// throw specific error
34+
// captcha not verified
35+
// can see result.ErrorCodes to find what's wrong
36+
// throw specific error
3737
}
3838
// it's ok
3939
```
@@ -82,4 +82,12 @@ func verifyCaptcha(next http.Handler) http.Handler {
8282
next.ServeHTTP(w, r)
8383
})
8484
}
85+
```
86+
87+
you can set `timeout` for verify request:
88+
89+
```go
90+
website := arcaptcha.NewWebsite("YOUR_SITE_KEY", "YOUR_SECRET_KEY")
91+
website.SetTimeout(1*time.Second)
92+
result, err := website.Verify("arcaptcha-response") // returns "context deadline" error if it takes more than 1 second
8593
```

0 commit comments

Comments
 (0)