who the actual fuck wrote this dogshit http lib
All checks were successful
Build and publish the docker image / build (push) Successful in 58s
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:
parent
a1b89e543c
commit
ef63d59931
2
main.go
2
main.go
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user