mirror of
https://github.com/datarhei/core.git
synced 2025-10-04 15:42:57 +08:00
Allow RTMP token as stream key in the path
This commit is contained in:
26
rtmp/rtmp_test.go
Normal file
26
rtmp/rtmp_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package rtmp
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestToken(t *testing.T) {
|
||||
data := [][]string{
|
||||
{"/foo/bar", "/foo", "bar"},
|
||||
{"/foo/bar?token=abc", "/foo/bar", "abc"},
|
||||
{"/foo/bar/abc", "/foo/bar", "abc"},
|
||||
}
|
||||
|
||||
for _, d := range data {
|
||||
u, err := url.Parse(d[0])
|
||||
require.NoError(t, err)
|
||||
|
||||
path, token := getToken(u)
|
||||
|
||||
require.Equal(t, d[1], path, "url=%s", u.String())
|
||||
require.Equal(t, d[2], token, "url=%s", u.String())
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user