mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 15:46:51 +08:00
request: insert Content-Length automatically
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -128,6 +129,10 @@ func (req *Request) Write(bw *bufio.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(req.Content) != 0 {
|
||||
req.Header["Content-Length"] = HeaderValue{strconv.FormatInt(int64(len(req.Content)), 10)}
|
||||
}
|
||||
|
||||
err = req.Header.write(bw)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user