~repos /gromer

#golang#htmx#ssr

git clone https://pyrossh.dev/repos/gromer.git

gromer is a framework and cli to build multipage web apps in golang using htmx and alpinejs.


9396d032 Peter John

tag: v1.1.1

v1.1.1

3 years ago
Fix ApiRoute CORS
Files changed (1) hide show
  1. http.go +2 -2
http.go CHANGED
@@ -181,7 +181,7 @@ func PerformRequest(route string, h interface{}, c interface{}, w http.ResponseW
181
181
  return
182
182
  }
183
183
  } else {
184
- RespondError(w, r, 400, eris.Errorf("Illegal Content-Type tag found %s", contentType))
184
+ RespondError(w, r, 400, eris.Errorf("Illegal Content-Type found %s", contentType))
185
185
  return
186
186
  }
187
187
  if !isJson {
@@ -349,7 +349,7 @@ func ApiRoute(router *mux.Router, method, route string, h interface{}) {
349
349
  router.HandleFunc(route, func(w http.ResponseWriter, r *http.Request) {
350
350
  ctx := context.WithValue(context.WithValue(r.Context(), "url", r.URL), "header", r.Header)
351
351
  PerformRequest(route, h, ctx, w, r, true)
352
- }).Methods(method)
352
+ }).Methods(method, "OPTIONS")
353
353
  }
354
354
 
355
355
  func GetUrl(ctx context.Context) *url.URL {