This commit is contained in:
cdle
2021-09-28 00:29:21 +08:00
parent d275e86b58
commit 42c96fa9b3
+7 -4
View File
@@ -3,6 +3,7 @@ package core
import ( import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net/url"
"regexp" "regexp"
"strings" "strings"
"time" "time"
@@ -50,17 +51,19 @@ func InitReplies() {
if reply.Request.Disappear { if reply.Request.Disappear {
s.Disappear() s.Disappear()
} }
url := reply.Request.Url Url := reply.Request.Url
body := reply.Request.Body body := reply.Request.Body
for k, v := range s.GetMatch() { for k, v := range s.GetMatch() {
url = strings.Replace(url, fmt.Sprintf(`{{%d}}`, k+1), v, -1) Url = strings.Replace(Url, fmt.Sprintf(`{{%d}}`, k+1), v, -1)
body = strings.Replace(body, fmt.Sprintf(`{{%d}}`, k+1), v, -1) body = strings.Replace(body, fmt.Sprintf(`{{%d}}`, k+1), v, -1)
Url = strings.Replace(Url, fmt.Sprintf(`{{encode(%d)}}`, k+1), url.QueryEscape(v), -1)
body = strings.Replace(body, fmt.Sprintf(`{{encode(%d)}}`, k+1), url.QueryEscape(v), -1)
} }
var req httplib.BeegoHTTPRequest var req httplib.BeegoHTTPRequest
if strings.ToLower(reply.Request.Method) == "post" { if strings.ToLower(reply.Request.Method) == "post" {
req = *httplib.Post(url) req = *httplib.Post(Url)
} else { } else {
req = *httplib.Get(url) req = *httplib.Get(Url)
} }
for _, header := range reply.Request.Headers { for _, header := range reply.Request.Headers {
ss := strings.Split(header, ":") ss := strings.Split(header, ":")