Add WebRTC stream id to whep response headers (#1879)

* Add WebRTC stream id to whep response headers

* change header name from UUID to ID

* add tests

---------

Co-authored-by: Victor Vitkovskiy <victor.vitkovskiy@mirasys.com>
Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
This commit is contained in:
Victor 2023-05-31 19:24:06 +03:00 committed by GitHub
parent 210603d7c4
commit 052da51af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -307,6 +307,7 @@ func (s *webRTCHTTPServer) onRequest(ctx *gin.Context) {
ctx.Writer.Header().Set("Content-Type", "application/sdp")
ctx.Writer.Header().Set("Access-Control-Expose-Headers", "E-Tag, Accept-Patch, Link")
ctx.Writer.Header().Set("E-Tag", res.sx.secret.String())
ctx.Writer.Header().Set("ID", res.sx.uuid.String())
ctx.Writer.Header().Set("Accept-Patch", "application/trickle-ice-sdpfrag")
ctx.Writer.Header()["Link"] = iceServersToLinkHeader(s.parent.genICEServers())
ctx.Writer.Header().Set("Location", ctx.Request.URL.String())

View File

@ -58,7 +58,9 @@ func whipPostOffer(t *testing.T, hc *http.Client, ur string,
require.NotEqual(t, 0, len(servers))
etag := res.Header.Get("E-Tag")
require.NotEqual(t, 0, len(etag))
require.NotEqual(t, "", etag)
require.NotEqual(t, "", res.Header.Get("ID"))
sdp, err := io.ReadAll(res.Body)
require.NoError(t, err)