serverconn: allow passing of raw base.Response.Body from Describe callbacks

When a server handler implements `OnDescribe()` it may return a
`base.Reponse` that carries a body, along with a `nil` stream.

`handleRequest()` should support that, and not override `res.Body`, and,
more importantly, not dereference the returned `nil` pointer.
This commit is contained in:
Daniel Mack
2021-07-16 15:29:38 +02:00
committed by Alessandro Ros
parent dae5a1f040
commit 23458a27b6

View File

@@ -357,7 +357,10 @@ func (sc *ServerConn) handleRequest(req *base.Request) (*base.Response, error) {
res.Header["Content-Base"] = base.HeaderValue{req.URL.String() + "/"}
res.Header["Content-Type"] = base.HeaderValue{"application/sdp"}
res.Body = stream.Tracks().Write()
if stream != nil {
res.Body = stream.Tracks().Write()
}
}
return res, err