From 8e89224e88a99b4d8acd02980d8cf37c7b7a9c13 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Fri, 19 Feb 2021 08:57:17 -0500 Subject: [PATCH] issue 275 --- http2.d | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/http2.d b/http2.d index 3375d72..26519db 100644 --- a/http2.d +++ b/http2.d @@ -2760,6 +2760,11 @@ class WebSocket { if(config.origin.length) append("Origin: ", origin, "\r\n"); + foreach(h; config.additionalHeaders) { + append(h); + append("\r\n"); + } + append("\r\n"); auto remaining = buffer[0 .. pos]; @@ -3003,6 +3008,19 @@ class WebSocket { string origin; /// Origin URL to send with the handshake, if desired. string protocol; /// the protocol header, if desired. + /++ + Additional headers to put in the HTTP request. These should be formatted `Name: value`, like for example: + + --- + Config config; + config.additionalHeaders ~= "Authorization: Bearer your_auth_token_here"; + --- + + History: + Added February 19, 2021 (included in dub version 9.2) + +/ + string[] additionalHeaders; + int pingFrequency = 5000; /// Amount of time (in msecs) of idleness after which to send an automatic ping }