withReadonly is middleware that sets readonly mode in the request context
(next http.Handler)
| 156 | |
| 157 | // withReadonly is middleware that sets readonly mode in the request context |
| 158 | func withReadonly(next http.Handler) http.Handler { |
| 159 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 160 | ctx := ghcontext.WithReadonly(r.Context(), true) |
| 161 | next.ServeHTTP(w, r.WithContext(ctx)) |
| 162 | }) |
| 163 | } |
| 164 | |
| 165 | // withToolset is middleware that extracts the toolset from the URL and sets it in the request context |
| 166 | func withToolset(next http.Handler) http.Handler { |