@@ -12,9 +12,9 @@ import (
1212 "github.com/samocodes/go-lrc/helpers"
1313 "github.com/samocodes/go-lrc/types"
1414
15- "github.com/go-chi/chi"
16- "github.com/go-chi/chi/middleware"
17- "github.com/go-chi/cors"
15+ "github.com/go-chi/chi/v5 "
16+ "github.com/go-chi/chi/v5/ middleware"
17+
1818 "github.com/unrolled/secure"
1919)
2020
@@ -25,22 +25,12 @@ func Routes() http.Handler {
2525 FrameDeny : true ,
2626 ContentTypeNosniff : true ,
2727 BrowserXssFilter : true ,
28-
29- // Allows htmx's script to be loaded
30- // ContentSecurityPolicy: "default-src 'self'; script-src 'self' https://unpkg.com 'nonce-a23gbfz9e'; style-src 'self';",
3128 })
3229
3330 router := chi .NewRouter ()
3431 router .Use (secureMiddleware .Handler )
3532 router .Use (middleware .Recoverer )
3633 router .Use (middleware .Logger )
37- router .Use (cors .Handler (cors.Options {
38- AllowedOrigins : []string {"http://*" , "https://*" },
39- AllowedMethods : []string {"GET" , "POST" , "PATCH" , "PUT" , "DELETE" , "OPTIONS" },
40- AllowedHeaders : []string {"Accept" , "Authorization" , "Content-Type" , "X-CSRF-Token" },
41- ExposedHeaders : []string {"Link" },
42- MaxAge : 300 ,
43- }))
4434
4535 router .Get ("/" , func (w http.ResponseWriter , r * http.Request ) {
4636 // if request header doesn't accepts text/html, then return a html template
@@ -73,7 +63,7 @@ func Routes() http.Handler {
7363 router .Post ("/lrc" , func (w http.ResponseWriter , r * http.Request ) {
7464 b , err := io .ReadAll (r .Body )
7565 if err != nil {
76- http .Error (w , "Body was not provided" , http .StatusBadRequest )
66+ http .Error (w , "Body was not provided! " , http .StatusBadRequest )
7767 return
7868 }
7969
0 commit comments