Include available features in header of backend requests to Nextcloud.

The header "X-Spreed-Signaling-Features" will contain a comma-separated list
of feature flags.
This commit is contained in:
Joachim Bauch
2021-11-03 15:24:27 +01:00
parent 2f8e7f9f66
commit a05acc9cb4
2 changed files with 5 additions and 0 deletions
+4
View File
@@ -56,6 +56,7 @@ const (
)
type BackendClient struct {
hub *Hub
transport *http.Transport
version string
backends *BackendConfiguration
@@ -342,6 +343,9 @@ func (b *BackendClient) PerformJSONRequest(ctx context.Context, u *url.URL, requ
req.Header.Set("Accept", "application/json")
req.Header.Set("OCS-APIRequest", "true")
req.Header.Set("User-Agent", "nextcloud-spreed-signaling/"+b.version)
if b.hub != nil {
req.Header.Set("X-Spreed-Signaling-Features", strings.Join(b.hub.info.Features, ", "))
}
// Add checksum so the backend can validate the request.
AddBackendChecksum(req, data, secret)