server: fill ctx.Query correctly (#73)

This commit is contained in:
aler9
2021-09-23 08:53:10 +02:00
parent dbfc058f0c
commit 84837b9751
7 changed files with 89 additions and 83 deletions

View File

@@ -14,7 +14,7 @@ func mustParseURL(s string) *URL {
return u
}
func TestURLErrors(t *testing.T) {
func TestURLParseErrors(t *testing.T) {
for _, ca := range []struct {
name string
enc string
@@ -48,42 +48,6 @@ func TestURLErrors(t *testing.T) {
}
}
func TestURLRTSPPath(t *testing.T) {
for _, ca := range []struct {
u *URL
b string
}{
{
mustParseURL("rtsp://localhost:8554/teststream"),
"teststream",
},
{
mustParseURL("rtsp://localhost:8554/test/stream"),
"test/stream",
},
{
mustParseURL("rtsp://192.168.1.99:554/test?user=tmp&password=BagRep1&channel=1&stream=0.sdp"),
"test",
},
{
mustParseURL("rtsp://192.168.1.99:554/te!st?user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
"te!st",
},
{
mustParseURL("rtsp://192.168.1.99:554/user=tmp&password=BagRep1!&channel=1&stream=0.sdp"),
"user=tmp&password=BagRep1!&channel=1&stream=0.sdp",
},
{
mustParseURL("rtsp://localhost:8554/teststream?query1?query2"),
"teststream",
},
} {
b, ok := ca.u.RTSPPath()
require.Equal(t, true, ok)
require.Equal(t, ca.b, b)
}
}
func TestURLClone(t *testing.T) {
u := mustParseURL("rtsp://localhost:8554/test/stream")
u2 := u.Clone()
@@ -102,12 +66,6 @@ func TestURLClone(t *testing.T) {
}, u2)
}
func TestURLErrorRTSPPath(t *testing.T) {
u := mustParseURL("rtsp://localhost:8554")
_, ok := u.RTSPPath()
require.Equal(t, false, ok)
}
func TestURLRTSPPathAndQuery(t *testing.T) {
for _, ca := range []struct {
u *URL