api: make CORS work by handling preflight OPTIONS request (#4264)

* make CORS work by handling preflight OPTIONS request

* Update api.go
This commit is contained in:
Girish Sonawane
2017-03-11 13:31:59 +05:30
committed by 无闻
parent 61e2bff757
commit b9bb4a62d6
2 changed files with 6 additions and 0 deletions

View File

@@ -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)