fix(CapSolver): separate CapSolver api from AntiGateV2
All checks were successful
release-tag / release (push) Successful in 1m53s

This commit is contained in:
2023-07-14 06:49:25 +03:00
parent 81193a05ef
commit dd10f15834
4 changed files with 253 additions and 4 deletions

View File

@ -23,10 +23,7 @@ func (a *antigateV2Api) Name() string {
}
func (a *antigateV2Api) Domains() []string {
return []string{
"api.anti-captcha.com",
"api.capsolver.com",
}
return []string{"api.anti-captcha.com"}
}
func (a *antigateV2Api) ServeHTTP(w http.ResponseWriter, r *http.Request) {
@ -244,6 +241,11 @@ func jsonHandler[T any](api *antigateV2Api, handler func(data T) any) func(http.
api.ctx.Logger.WithFields(logrus.Fields{"handler": api.Name(), "response": response}).Debug("response")
marshaled, _ := json.Marshal(response)
if _, ok := response.(*antigateError); ok {
w.WriteHeader(400)
}
w.Write(marshaled)
}
}