From 9471c4a5993edac272c628095d8da17bd08416ba Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Fri, 8 May 2026 20:31:30 -0400 Subject: [PATCH] fix(tests): URL-encode series name in special characters test The TestGetSeries_SpecialCharactersInName test was failing with a 400 status because the series name 'Series: Book & Other (Vol. 1)' was interpolated directly into the URL without encoding. The ampersand was parsed as a query parameter delimiter, corrupting the request. Use url.QueryEscape() to properly encode the name parameter. --- cmd/server/tests/series_integration_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/server/tests/series_integration_test.go b/cmd/server/tests/series_integration_test.go index 0b732ae..4371596 100644 --- a/cmd/server/tests/series_integration_test.go +++ b/cmd/server/tests/series_integration_test.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "net/http" + "net/url" "testing" "github.com/stretchr/testify/assert" @@ -254,7 +255,7 @@ func (s *SeriesIntegrationTestSuite) TestGetSeriesBooks_Unauthorized() { func (s *SeriesIntegrationTestSuite) TestGetSeries_SpecialCharactersInName() { seriesName := "Series: Book & Other (Vol. 1)" - url := fmt.Sprintf("%s/api/series/books?library_id=%s&name=%s", s.setup.Server.URL, s.libraryID, seriesName) + url := fmt.Sprintf("%s/api/series/books?library_id=%s&name=%s", s.setup.Server.URL, s.libraryID, url.QueryEscape(seriesName)) req, _ := http.NewRequest("GET", url, nil) req.Header.Set("Authorization", "Bearer "+s.token)