Skip to content

Commit

Permalink
webrtc: add POST and PATCH methods to Access-Control-Allow-Methods (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 authored May 20, 2023
1 parent 1fe22a8 commit 1889641
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/core/hls_http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (s *hlsHTTPServer) onRequest(ctx *gin.Context) {
case http.MethodGet:

case http.MethodOptions:
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS")
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", ctx.Request.Header.Get("Access-Control-Request-Headers"))
ctx.Writer.WriteHeader(http.StatusOK)
return
Expand Down
4 changes: 2 additions & 2 deletions internal/core/webrtc_http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
case http.MethodGet:

case http.MethodOptions:
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS")
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", ctx.Request.Header.Get("Access-Control-Request-Headers"))
ctx.Writer.WriteHeader(http.StatusOK)
return
Expand Down Expand Up @@ -272,7 +272,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
case "whip", "whep":
switch ctx.Request.Method {
case http.MethodOptions:
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "GET, OPTIONS")
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, POST, PATCH")
ctx.Writer.Header().Set("Access-Control-Allow-Headers", ctx.Request.Header.Get("Access-Control-Request-Headers"))
ctx.Writer.Header()["Link"] = iceServersToLinkHeader(s.parent.genICEServers())
ctx.Writer.WriteHeader(http.StatusOK)
Expand Down

0 comments on commit 1889641

Please sign in to comment.