mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
add Request.String(), Response.String()
This commit is contained in:
@@ -3,6 +3,7 @@ package base
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
@@ -133,3 +134,10 @@ func (req Request) Write(bw *bufio.Writer) error {
|
||||
|
||||
return bw.Flush()
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (req Request) String() string {
|
||||
buf := bytes.NewBuffer(nil)
|
||||
req.Write(bufio.NewWriter(buf))
|
||||
return buf.String()
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package base
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
@@ -214,3 +215,10 @@ func (res Response) Write(bw *bufio.Writer) error {
|
||||
|
||||
return bw.Flush()
|
||||
}
|
||||
|
||||
// String implements fmt.Stringer.
|
||||
func (res Response) String() string {
|
||||
buf := bytes.NewBuffer(nil)
|
||||
res.Write(bufio.NewWriter(buf))
|
||||
return buf.String()
|
||||
}
|
||||
|
Reference in New Issue
Block a user