From 4a9f4a001e5112fc4e9da018e3c8b23da5e27a30 Mon Sep 17 00:00:00 2001 From: itowlson Date: Mon, 18 Dec 2023 10:40:11 +1300 Subject: [PATCH] Mutable access to request headers Signed-off-by: itowlson --- sdk/rust/src/http.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk/rust/src/http.rs b/sdk/rust/src/http.rs index e9ddebb54..41e2da213 100644 --- a/sdk/rust/src/http.rs +++ b/sdk/rust/src/http.rs @@ -116,6 +116,16 @@ impl Request { self.headers.get(&name.to_lowercase()) } + /// Set a header + pub fn set_header(&mut self, name: impl Into, value: impl Into) { + self.headers.insert( + name.into(), + HeaderValue { + inner: HeaderValueRep::String(value.into()), + }, + ); + } + /// The request body pub fn body(&self) -> &[u8] { &self.body