Skip to content

Commit

Permalink
Mutable access to request headers
Browse files Browse the repository at this point in the history
Signed-off-by: itowlson <[email protected]>
  • Loading branch information
itowlson committed Dec 18, 2023
1 parent abd5736 commit 4a9f4a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sdk/rust/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ impl Request {
self.headers.get(&name.to_lowercase())
}

/// Set a header
pub fn set_header(&mut self, name: impl Into<String>, value: impl Into<String>) {
self.headers.insert(
name.into(),
HeaderValue {
inner: HeaderValueRep::String(value.into()),
},
);
}

/// The request body
pub fn body(&self) -> &[u8] {
&self.body
Expand Down

0 comments on commit 4a9f4a0

Please sign in to comment.