Skip to content

Commit

Permalink
Merge pull request hieblmi#24 from Filiprogrammer/cors-headers
Browse files Browse the repository at this point in the history
Add CORS headers to HTTP responses
  • Loading branch information
hieblmi authored May 20, 2024
2 parents 131a521 + a1c9918 commit c466aac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions invoice_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func (m *InvoiceManager) handleInvoiceCreation(config ServerConfig) http.Handler
return func(w http.ResponseWriter, r *http.Request) {
log.Infof("Handling invoice creation: %v\n", *r)
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")

keys, hasAmount := r.URL.Query()["amount"]
if !hasAmount || len(keys[0]) < 1 {
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func handleLNUrlp(config ServerConfig, metadata string) http.HandlerFunc {
Callback: config.InvoiceCallback,
}
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")
w.WriteHeader(http.StatusCreated)
json.NewEncoder(w).Encode(resp)
}
Expand Down

0 comments on commit c466aac

Please sign in to comment.