From b9bb4a62d60c0e8b863f160e5f35e67b94c18e6c Mon Sep 17 00:00:00 2001 From: Girish Sonawane Date: Sat, 11 Mar 2017 13:31:59 +0530 Subject: api: make CORS work by handling preflight OPTIONS request (#4264) * make CORS work by handling preflight OPTIONS request * Update api.go --- routers/api/v1/api.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'routers/api/v1') diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 6221bcd7..35234fa8 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -173,6 +173,9 @@ func RegisterRoutes(m *macaron.Macaron) { bind := binding.Bind m.Group("/v1", func() { + // Handle preflight OPTIONS request + m.Options("/*", func() {}) + // Miscellaneous m.Post("/markdown", bind(api.MarkdownOption{}), misc.Markdown) m.Post("/markdown/raw", misc.MarkdownRaw) -- cgit v1.2.3