who the actual fuck wrote this dogshit http lib
All checks were successful
Build and publish the docker image / build (push) Successful in 58s

Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
ngn 2025-05-02 17:26:13 +03:00
parent a1b89e543c
commit ef63d59931
Signed by: ngn
GPG Key ID: A3654DF5AD9F641D
2 changed files with 12 additions and 13 deletions

View File

@ -29,7 +29,7 @@ func main() {
if os.Getenv("DEV") != "true" {
gin.SetMode(gin.ReleaseMode)
fmt.Println("Listening on %s:%s\n", host, port)
fmt.Printf("Listening on %s:%s\n", host, port)
}
r := gin.Default()

View File

@ -28,10 +28,8 @@ type response struct {
func GET(target string) ([]byte, int, http.Header, error) {
var (
client *resty.Client = resty.New()
res *resty.Response = nil
frurl string = ""
err error
client *resty.Client = resty.New()
frurl string = ""
)
if frurl = os.Getenv("FLARERESOLVER"); frurl == "" {
@ -44,15 +42,16 @@ func GET(target string) ([]byte, int, http.Header, error) {
frurl, _ = url.JoinPath(frurl, "/v1")
client.R().SetHeader("Content-Type", "application/json")
client.R().SetBody(request{
Cmd: "request.get",
Url: target,
MaxTimeout: 60000,
})
client.R().SetResult(&response{})
res, err := client.R().
SetBody(request{
Cmd: "request.get",
Url: target,
MaxTimeout: 60000,
}).
SetResult(&response{}).
Post(frurl)
if res, err = client.R().Post(frurl); err != nil {
if err != nil {
return nil, 0, nil, err
}