Skip to content

Commit c8d97d3

Browse files
bmoffattDavid Barsky
authored and
David Barsky
committed
send the runtime user agent when polling for events (#180)
1 parent 6866f2b commit c8d97d3

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lambda-runtime-client/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lambda_runtime_client"
3-
version = "0.2.2"
3+
version = "0.2.3"
44
authors = ["Stefano Buliani", "David Barsky"]
55
edition = "2018"
66
description = "Client SDK for AWS Lambda's runtime APIs"
@@ -27,4 +27,4 @@ lambda_runtime_errors = { path = "../lambda-runtime-errors", version = "^0.1" }
2727
failure = "^0.1"
2828

2929
[dev-dependencies]
30-
chrono = "^0.4"
30+
chrono = "^0.4"

lambda-runtime-client/src/client.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,19 @@ impl<'ev> RuntimeClient {
171171
pub fn next_event(&self) -> Result<(Vec<u8>, EventContext), ApiError> {
172172
trace!("Polling for next event");
173173

174+
let req = Request::builder()
175+
.method(Method::GET)
176+
.uri(self.next_endpoint.clone())
177+
.header(header::USER_AGENT, self.runtime_agent.clone())
178+
.body(Body::from(""))
179+
.unwrap();
180+
174181
// We wait instead of processing the future asynchronously because AWS Lambda
175182
// itself enforces only one event per container at a time. No point in taking on
176183
// the additional complexity.
177184
let resp = self
178185
.http_client
179-
.get(self.next_endpoint.clone())
186+
.request(req)
180187
.wait()
181188
.context(ApiErrorKind::Unrecoverable("Could not fetch next event".to_string()))?;
182189

0 commit comments

Comments
 (0)