Skip to content

Commit

Permalink
Merge pull request #2187 from itowlson/sdk-http-mutate-headers
Browse files Browse the repository at this point in the history
Mutable access to request headers
  • Loading branch information
itowlson authored Dec 19, 2023
2 parents cb29f47 + 4a9f4a0 commit 49ba8fe
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 49ba8fe

Please sign in to comment.