Skip to content

Commit

Permalink
remove cors handler
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Jul 23, 2024
1 parent fb61c50 commit fc2f998
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
"strings"

"github.com/rs/cors"
"go.sia.tech/faucet/faucet"
"go.sia.tech/jape"
"go.sia.tech/siad/types"
Expand Down Expand Up @@ -87,16 +86,10 @@ func (a *API) handleCreateRequest(jc jape.Context) {

// Serve serves the API on the provided listener.
func (a *API) Serve(l net.Listener) error {
router := jape.Mux(map[string]jape.Handler{
return http.Serve(l, jape.Mux(map[string]jape.Handler{
"GET /:id": a.handleGetRequest,
"POST /": a.handleCreateRequest,
})
handler := cors.New(cors.Options{
AllowedOrigins: []string{"*"},
AllowedMethods: []string{http.MethodGet, http.MethodPost},
AllowedHeaders: []string{"Content-Type"},
}).Handler(router)
return http.Serve(l, handler)
}))
}

// New initializes an API router.
Expand Down

0 comments on commit fc2f998

Please sign in to comment.