mirror of
https://github.com/gin-gonic/gin.git
synced 2026-09-04 22:53:34 +08:00
refactor: replace filterFlags with mime.ParseMediaType
This commit is contained in:
parent
34dac209ff
commit
9cb41f00e8
10
utils.go
10
utils.go
@ -7,6 +7,7 @@ package gin
|
||||
import (
|
||||
"encoding/xml"
|
||||
"math"
|
||||
"mime"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
@ -89,12 +90,11 @@ func assert1(guard bool, text string) {
|
||||
}
|
||||
|
||||
func filterFlags(content string) string {
|
||||
for i, char := range content {
|
||||
if char == ' ' || char == ';' {
|
||||
return content[:i]
|
||||
}
|
||||
mediatype, _, err := mime.ParseMediaType(content)
|
||||
if err != nil {
|
||||
return content
|
||||
}
|
||||
return content
|
||||
return mediatype
|
||||
}
|
||||
|
||||
func chooseData(custom, wildcard any) any {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user