Skip to content

Commit da0d383

Browse files
committed
fix(rewriter): wildcard route
1 parent 9e3a74d commit da0d383

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

backend/cmd/rewriter/main.go

+14
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,19 @@ func metaHandler[T any](rw *rewriter, factory func(string) *T, optFactory func(*
176176
}
177177
}
178178

179+
func defaultHandler(rw *rewriter) gin.HandlerFunc {
180+
return func(ctx *gin.Context) {
181+
h, err := rw.getDefaultHtmlString()
182+
if err != nil {
183+
log.L.Error().Err(err).Msg("error occurred trying to retrieve default html")
184+
}
185+
186+
ctx.Header("Content-Type", "text/html")
187+
ctx.String(200, h)
188+
return
189+
}
190+
}
191+
179192
func episodeHandler(rw *rewriter) gin.HandlerFunc {
180193
return metaHandler(rw, getEpisode, metaForEpisode)
181194
}
@@ -201,6 +214,7 @@ func main() {
201214
r := gin.Default()
202215

203216
r.GET("episode/:id", episodeHandler(rw))
217+
r.GET("episode/:id/*default", defaultHandler(rw))
204218

205219
r.GET("/versionz", version.GinHandler)
206220

0 commit comments

Comments
 (0)