mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-15 19:50:37 +03:00
Parse ParamBool case-insensitively (#1151)
This commit is contained in:
parent
bebfe296a5
commit
65ccd4c99d
@ -84,7 +84,7 @@ func ParamInts(r *http.Request, param string) []int {
|
||||
}
|
||||
|
||||
func ParamBool(r *http.Request, param string, def bool) bool {
|
||||
p := ParamString(r, param)
|
||||
p := strings.ToLower(ParamString(r, param))
|
||||
if p == "" {
|
||||
return def
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ var _ = Describe("Request Helpers", func() {
|
||||
Describe("ParamBool", func() {
|
||||
Context("value is true", func() {
|
||||
BeforeEach(func() {
|
||||
r = httptest.NewRequest("GET", "/ping?b=true&c=on&d=1", nil)
|
||||
r = httptest.NewRequest("GET", "/ping?b=true&c=on&d=1&e=True", nil)
|
||||
})
|
||||
|
||||
It("parses 'true'", func() {
|
||||
@ -161,6 +161,10 @@ var _ = Describe("Request Helpers", func() {
|
||||
It("parses '1'", func() {
|
||||
Expect(ParamBool(r, "d", false)).To(BeTrue())
|
||||
})
|
||||
|
||||
It("parses 'True'", func() {
|
||||
Expect(ParamBool(r, "e", false)).To(BeTrue())
|
||||
})
|
||||
})
|
||||
|
||||
Context("value is false", func() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user