api_key验证方式

This commit is contained in:
ken 2025-04-06 12:01:08 +08:00
parent fbdd8c2ff2
commit 18e919113f

View File

@ -1,7 +1,6 @@
package agent package agent
import ( import (
"fmt"
"net/http" "net/http"
"strings" "strings"
) )
@ -21,7 +20,6 @@ func (a *keyChecker) check(c *client, r *http.Request) bool {
apikey = r.RequestURI[i+len("api_key="):] apikey = r.RequestURI[i+len("api_key="):]
} }
} }
fmt.Printf("apikey = %s\n", apikey)
if len(apikey) > 0 && strings.HasPrefix(apikey, "simpletest2025_") { if len(apikey) > 0 && strings.HasPrefix(apikey, "simpletest2025_") {
c.setApiKey(apikey) c.setApiKey(apikey)
return true return true