mirror of
https://github.com/aljazceru/khatru.git
synced 2026-02-18 19:24:23 +01:00
fix(blossom): CORS headers required by noStrudel
This commit is contained in:
committed by
fiatjaf_
parent
b617fea679
commit
1c15db2ca1
@@ -33,6 +33,12 @@ func New(rl *khatru.Relay, serviceURL string) *BlossomServer {
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "OPTIONS" {
|
||||
setCors(w)
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
|
||||
if r.URL.Path == "/upload" {
|
||||
if r.Method == "PUT" {
|
||||
setCors(w)
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
|
||||
func setCors(w http.ResponseWriter) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Authorization")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET PUT DELETE")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, PUT, DELETE, OPTIONS")
|
||||
}
|
||||
|
||||
func blossomError(w http.ResponseWriter, msg string, code int) {
|
||||
|
||||
Reference in New Issue
Block a user