Skip to content

Commit

Permalink
fix(repl): no-cors mode
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Nov 26, 2020
1 parent d4af36b commit 6410c1b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmd/changelog-remote/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ func handler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", r.Header.Get("Origin"))
w.Header().Set("Access-Control-Allow-Methods", "GET")

if r.Method == http.MethodOptions {
w.WriteHeader(200)
_, _ = w.Write([]byte{})
return
}

query := r.URL.Query()

username := query.Get("username")
Expand Down
5 changes: 4 additions & 1 deletion repl/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ function onSubmit() {
form.value.username || ""
}&repo=${form.value.repo || ""}&version=${
form.value.version || ""
}&template=${tpl || ""}`
}&template=${tpl || ""}`,
{
mode: "no-cors",
}
)
.then((res) => {
return res.text();
Expand Down

0 comments on commit 6410c1b

Please sign in to comment.