repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
051f98b
parent
2e484cd
author
Eric Bower
date
2024-01-28 04:38:21 +0000 UTC
fix(pgs): classify xml when calc routes

`.xml` files were returning as `text/plain` which has different routing
rules than what xml should have.

Closes https://github.com/picosh/pico/issues/72
2 files changed,  +10, -0
M pgs/calc_route_test.go
+8, -0
 1@@ -78,6 +78,14 @@ func TestCalcPossibleRoutes(t *testing.T) {
 2 				{Filepath: "test/404.html", Status: 404},
 3 			},
 4 		},
 5+		{
 6+			Name: "xml",
 7+			Actual: calcPossibleRoutes("test", "index.xml", []*RedirectRule{}),
 8+			Expected: []*HttpReply{
 9+				{Filepath: "test/index.xml", Status: 200},
10+				{Filepath: "test/404.html", Status: 404},
11+			},
12+		},
13 	}
14 
15 	for _, fixture := range fixtures {
M shared/storage/proxy.go
+2, -0
1@@ -52,6 +52,8 @@ func GetMimeType(fpath string) string {
2 		return "application/atom+xml"
3 	} else if ext == ".webmanifest" {
4 		return "application/manifest+json"
5+	} else if ext == ".xml" {
6+		return "application/xml"
7 	} else if ext == ".txt" {
8 		return "text/plain"
9 	}