convenience method

This commit is contained in:
Adam D. Ruppe 2025-10-12 20:34:30 -04:00
parent 23dadb8e1d
commit db6f95f4b7
1 changed files with 10 additions and 0 deletions

10
http2.d
View File

@ -1049,6 +1049,16 @@ class HttpRequest {
this(null, where, method, cache, timeout, proxy); this(null, where, method, cache, timeout, proxy);
} }
/++
Adds the given header to the request, without checking for duplicates or similar.
History:
Added October 8, 2025. Previously, you'd have to do `request.requestParameters.headers ~= "Name: Value"` (which is exactly what this does, but less conveniently).
+/
void addHeader(string name, string value) {
this.requestParameters.headers ~= name ~ ": " ~ value;
}
/++ /++
Sets the timeout from inactivity on the request. This is the amount of time that passes with no send or receive activity on the request before it fails with "request timed out" error. Sets the timeout from inactivity on the request. This is the amount of time that passes with no send or receive activity on the request before it fails with "request timed out" error.