webrtc: fix ETag header name according to specification (#2396) (#2401)
Some checks reported warnings
test / test64 (push) Has been cancelled
test / test32 (push) Has been cancelled
test / test_highlevel (push) Has been cancelled
lint / code (push) Has been cancelled
lint / mod-tidy (push) Has been cancelled
lint / apidocs (push) Has been cancelled

This commit is contained in:
Alessandro Ros
2023-09-23 14:21:53 +02:00
committed by GitHub
parent 75f518a827
commit f1e28d053f
5 changed files with 7 additions and 7 deletions

View File

@@ -262,8 +262,8 @@ 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("Access-Control-Expose-Headers", "ETag, Accept-Patch, Link")
ctx.Writer.Header().Set("ETag", 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"] = whip.LinkHeaderMarshal(servers)

View File

@@ -346,7 +346,7 @@ class Transmitter {
if (res.status !== 201) {
throw new Error('bad status code');
}
this.eTag = res.headers.get('E-Tag');
this.eTag = res.headers.get('ETag');
return res.text();
})
.then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({

View File

@@ -155,7 +155,7 @@ class WHEPClient {
if (res.status !== 201) {
throw new Error('bad status code');
}
this.eTag = res.headers.get('E-Tag');
this.eTag = res.headers.get('ETag');
return res.text();
})
.then((sdp) => this.onRemoteAnswer(new RTCSessionDescription({

View File

@@ -88,7 +88,7 @@ func TestWebRTCSource(t *testing.T) {
w.Header().Set("Content-Type", "application/sdp")
w.Header().Set("Accept-Patch", "application/trickle-ice-sdpfrag")
w.Header().Set("E-Tag", "test_etag")
w.Header().Set("ETag", "test_etag")
w.Header().Set("Location", "/my/resource/sessionid")
w.WriteHeader(http.StatusCreated)
w.Write([]byte(pc.LocalDescription().SDP))

View File

@@ -53,9 +53,9 @@ func PostOffer(
Location := res.Header.Get("Location")
etag := res.Header.Get("E-Tag")
etag := res.Header.Get("ETag")
if etag == "" {
return nil, fmt.Errorf("E-Tag is missing")
return nil, fmt.Errorf("ETag is missing")
}
sdp, err := io.ReadAll(res.Body)