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" {
|
if os.Getenv("DEV") != "true" {
|
||||||
gin.SetMode(gin.ReleaseMode)
|
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()
|
r := gin.Default()
|
||||||
|
@ -29,9 +29,7 @@ type response struct {
|
|||||||
func GET(target string) ([]byte, int, http.Header, error) {
|
func GET(target string) ([]byte, int, http.Header, error) {
|
||||||
var (
|
var (
|
||||||
client *resty.Client = resty.New()
|
client *resty.Client = resty.New()
|
||||||
res *resty.Response = nil
|
|
||||||
frurl string = ""
|
frurl string = ""
|
||||||
err error
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if frurl = os.Getenv("FLARERESOLVER"); frurl == "" {
|
if frurl = os.Getenv("FLARERESOLVER"); frurl == "" {
|
||||||
@ -44,15 +42,16 @@ func GET(target string) ([]byte, int, http.Header, error) {
|
|||||||
|
|
||||||
frurl, _ = url.JoinPath(frurl, "/v1")
|
frurl, _ = url.JoinPath(frurl, "/v1")
|
||||||
|
|
||||||
client.R().SetHeader("Content-Type", "application/json")
|
res, err := client.R().
|
||||||
client.R().SetBody(request{
|
SetBody(request{
|
||||||
Cmd: "request.get",
|
Cmd: "request.get",
|
||||||
Url: target,
|
Url: target,
|
||||||
MaxTimeout: 60000,
|
MaxTimeout: 60000,
|
||||||
})
|
}).
|
||||||
client.R().SetResult(&response{})
|
SetResult(&response{}).
|
||||||
|
Post(frurl)
|
||||||
|
|
||||||
if res, err = client.R().Post(frurl); err != nil {
|
if err != nil {
|
||||||
return nil, 0, nil, err
|
return nil, 0, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user