mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-28 22:12:00 -08:00
webrtc, hls: reply status code 204 to OPTIONS requests (#2141)
This commit is contained in:
parent
42f9bacefb
commit
ef8b9fb63d
3 changed files with 5 additions and 5 deletions
|
|
@ -101,7 +101,7 @@ func (s *hlsHTTPServer) onRequest(ctx *gin.Context) {
|
|||
case http.MethodOptions:
|
||||
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET")
|
||||
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Range")
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Writer.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
|
||||
case http.MethodGet:
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
|
|||
case http.MethodOptions:
|
||||
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PATCH")
|
||||
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, If-Match")
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Writer.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
|
||||
case http.MethodGet:
|
||||
|
|
@ -359,7 +359,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
|
|||
ctx.Writer.Header().Set("Access-Control-Allow-Methods", "OPTIONS, GET, POST, PATCH")
|
||||
ctx.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, If-Match")
|
||||
ctx.Writer.Header()["Link"] = iceServersToLinkHeader(servers)
|
||||
ctx.Writer.WriteHeader(http.StatusOK)
|
||||
ctx.Writer.WriteHeader(http.StatusNoContent)
|
||||
|
||||
case http.MethodPost:
|
||||
if ctx.Request.Header.Get("Content-Type") != "application/sdp" {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func whipGetICEServers(
|
|||
require.NoError(t, err)
|
||||
defer res.Body.Close()
|
||||
|
||||
require.Equal(t, http.StatusOK, res.StatusCode)
|
||||
require.Equal(t, http.StatusNoContent, res.StatusCode)
|
||||
|
||||
link, ok := res.Header["Link"]
|
||||
require.Equal(t, true, ok)
|
||||
|
|
@ -464,7 +464,7 @@ func TestWebRTCPublish(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
defer res.Body.Close()
|
||||
|
||||
require.Equal(t, http.StatusOK, res.StatusCode)
|
||||
require.Equal(t, http.StatusNoContent, res.StatusCode)
|
||||
|
||||
if auth != "none" {
|
||||
_, ok := res.Header["Link"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue