mirror of
https://github.com/pgsty/minio.git
synced 2026-07-15 16:30:29 +03:00
use ParseForm() to allow query param lookups once (#12900)
``` cpu: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz BenchmarkURLQueryForm BenchmarkURLQueryForm-4 247099363 4.809 ns/op 0 B/op 0 allocs/op BenchmarkURLQuery BenchmarkURLQuery-4 2517624 462.1 ns/op 432 B/op 4 allocs/op PASS ok github.com/minio/minio/cmd 3.848s ```
This commit is contained in:
@@ -45,6 +45,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strconv"
|
||||
@@ -1648,12 +1649,8 @@ func ExecObjectLayerAPIAnonTest(t *testing.T, obj ObjectLayer, testName, bucketN
|
||||
t.Fatal(failTestStr(unknownSignTestStr, "error response failed to parse error XML"))
|
||||
}
|
||||
|
||||
if actualError.BucketName != bucketName {
|
||||
t.Fatal(failTestStr(unknownSignTestStr, "error response bucket name differs from expected value"))
|
||||
}
|
||||
|
||||
if actualError.Key != objectName {
|
||||
t.Fatal(failTestStr(unknownSignTestStr, "error response object name differs from expected value"))
|
||||
if path.Clean(actualError.Resource) != pathJoin(SlashSeparator, bucketName, SlashSeparator, objectName) {
|
||||
t.Fatal(failTestStr(unknownSignTestStr, "error response resource differs from expected value"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2035,13 +2032,15 @@ func registerAPIFunctions(muxRouter *mux.Router, objLayer ObjectLayer, apiFuncti
|
||||
func initTestAPIEndPoints(objLayer ObjectLayer, apiFunctions []string) http.Handler {
|
||||
// initialize a new mux router.
|
||||
// goriilla/mux is the library used to register all the routes and handle them.
|
||||
muxRouter := mux.NewRouter().SkipClean(true)
|
||||
muxRouter := mux.NewRouter().SkipClean(true).UseEncodedPath()
|
||||
if len(apiFunctions) > 0 {
|
||||
// Iterate the list of API functions requested for and register them in mux HTTP handler.
|
||||
registerAPIFunctions(muxRouter, objLayer, apiFunctions...)
|
||||
muxRouter.Use(globalHandlers...)
|
||||
return muxRouter
|
||||
}
|
||||
registerAPIRouter(muxRouter)
|
||||
muxRouter.Use(globalHandlers...)
|
||||
return muxRouter
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user