🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Parse ParamBool case-insensitively (#1151)
Steve Richter65ccd4c99de6
diff --git a/utils/request_helpers.go b/utils/request_helpers.goindex 75a38c586..74210c32d 100644--- a/utils/request_helpers.go+++ b/utils/request_helpers.go@@ -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}diff --git a/utils/request_helpers_test.go b/utils/request_helpers_test.goindex 48c6e49c9..e6d46e4a1 100644--- a/utils/request_helpers_test.go+++ b/utils/request_helpers_test.go@@ -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() {