iot_server/internal/tools/openapihelper/helper.go

19 lines
294 B
Go
Raw Normal View History

2023-08-28 06:49:44 +00:00
package openapihelper
import (
"net/http"
"github.com/gorilla/schema"
)
var decoder *schema.Decoder
func init() {
decoder = schema.NewDecoder()
decoder.IgnoreUnknownKeys(true)
}
func UrlDecodeParam(obj interface{}, r *http.Request) error {
return decoder.Decode(obj, r.URL.Query())
}