mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-24 22:25:15 +00:00
17 lines
540 B
Go
17 lines
540 B
Go
package routes
|
|
|
|
import (
|
|
"github.com/labstack/echo"
|
|
"net/http"
|
|
)
|
|
|
|
// SetCORSHeader sets relevant CORS headers for Cross-Site-Requests to the api
|
|
func SetCORSHeader(c echo.Context) error {
|
|
res := c.Response()
|
|
res.Header().Set("Access-Control-Allow-Origin", "*")
|
|
res.Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE")
|
|
res.Header().Set("Access-Control-Allow-Headers", "authorization,content-type")
|
|
res.Header().Set("Access-Control-Expose-Headers", "authorization,content-type")
|
|
return c.String(http.StatusOK, "")
|
|
}
|