mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
improve coverage
This commit is contained in:
@@ -222,6 +222,16 @@ func TestRequestReadErrors(t *testing.T) {
|
||||
[]byte("GET rtsp://testing123 RTSP/1.0\r\nContent-Length: 17\r\n\r\n123"),
|
||||
"unexpected EOF",
|
||||
},
|
||||
{
|
||||
"invalid content-length",
|
||||
[]byte("GET rtsp://testing123 RTSP/1.0\r\nContent-Length: aaa\r\n\r\n123"),
|
||||
"invalid Content-Length",
|
||||
},
|
||||
{
|
||||
"too big content-length",
|
||||
[]byte("GET rtsp://testing123 RTSP/1.0\r\nContent-Length: 1000000\r\n\r\n123"),
|
||||
"Content-Length exceeds 131072 (it's 1000000)",
|
||||
},
|
||||
} {
|
||||
t.Run(ca.name, func(t *testing.T) {
|
||||
var req Request
|
||||
@@ -245,3 +255,13 @@ func TestRequestReadIgnoreFrames(t *testing.T) {
|
||||
err := req.ReadIgnoreFrames(rb, buf)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestRequestReadIgnoreFramesError(t *testing.T) {
|
||||
byts := []byte{0x25}
|
||||
|
||||
rb := bufio.NewReader(bytes.NewBuffer(byts))
|
||||
buf := make([]byte, 10)
|
||||
var req Request
|
||||
err := req.ReadIgnoreFrames(rb, buf)
|
||||
require.Equal(t, "EOF", err.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user