mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-20 02:00:05 -08:00
support multiple CORS origins (#5150)
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
parent
14ab95f39c
commit
ade0cddeb3
24 changed files with 441 additions and 180 deletions
|
|
@ -13,36 +13,6 @@ import (
|
|||
"github.com/bluenviron/mediamtx/internal/test"
|
||||
)
|
||||
|
||||
func TestFilterEmptyPath(t *testing.T) {
|
||||
s := &Server{
|
||||
Address: "localhost:4555",
|
||||
ReadTimeout: 10 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
Parent: test.NilLogger,
|
||||
Handler: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}),
|
||||
}
|
||||
err := s.Initialize()
|
||||
require.NoError(t, err)
|
||||
defer s.Close()
|
||||
|
||||
conn, err := net.Dial("tcp", "localhost:4555")
|
||||
require.NoError(t, err)
|
||||
defer conn.Close()
|
||||
|
||||
_, err = conn.Write([]byte("OPTIONS / HTTP/1.1\n" +
|
||||
"Host: localhost:8889\n\n"))
|
||||
require.NoError(t, err)
|
||||
|
||||
buf := make([]byte, 200)
|
||||
n, err := conn.Read(buf)
|
||||
require.NoError(t, err)
|
||||
|
||||
res := strings.Split(string(buf[:n]), "\r\n")
|
||||
require.Equal(t, "HTTP/1.1 200 OK", res[0])
|
||||
}
|
||||
|
||||
func TestUnixSocket(t *testing.T) {
|
||||
s := &Server{
|
||||
Address: "unix://http.sock",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue