Skip to content

Commit

Permalink
return expected cors headers in delegated translator
Browse files Browse the repository at this point in the history
  • Loading branch information
willscott authored and masih committed Dec 3, 2022
1 parent 253d267 commit 145bac0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions delegated_translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ func (dt *delegatedTranslator) find(w http.ResponseWriter, r *http.Request) {
return
}

h := w.Header()
h.Add("Access-Control-Allow-Origin", "*")
h.Add("Access-Control-Allow-Methods", "GET, POST, OPTIONS")
if r.Method == http.MethodOptions {
w.WriteHeader(http.StatusOK)
w.Write([]byte{})
return
}

// translate URL

rcode, resp := dt.be(r.Context(), "GET", r.URL, []byte{})
Expand Down

0 comments on commit 145bac0

Please sign in to comment.