优化结构
This commit is contained in:
@@ -2,6 +2,7 @@ package middleware
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
@@ -12,6 +13,16 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func TestOperationQueryBodyPreservesEncodedSeparators(t *testing.T) {
|
||||
var values map[string]string
|
||||
if err := json.Unmarshal(operationQueryBody("filter=one%3Dtwo%26three&repeat=first&repeat=last"), &values); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if values["filter"] != "one=two&three" || values["repeat"] != "last" {
|
||||
t.Fatalf("unexpected query body: %#v", values)
|
||||
}
|
||||
}
|
||||
|
||||
func runErrorAudit(t *testing.T, path, response string, logger *slog.Logger) {
|
||||
t.Helper()
|
||||
gin.SetMode(gin.TestMode)
|
||||
|
||||
Reference in New Issue
Block a user