Skip to content

Commit 3a1ff71

Browse files
authored
Merge pull request #137 from nao1215/refactor/code-review-fixes
Refactor: consolidate test helpers, parameterize tests, and fix WASM OOM bug
2 parents a37a38a + 1b465cc commit 3a1ff71

File tree

9 files changed

+263
-420
lines changed

9 files changed

+263
-420
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ aws-smithy-types = "1"
7474
bytes = "1"
7575
http = "1"
7676
rustls = { version = "0.23", features = ["ring"] }
77+
rstest = "0.25"
7778
serial_test = "3"
7879
tempfile = "3"

src/adapters/server/auth.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,12 @@ pub(super) fn parse_query_params(
277277
for (name, value) in url::form_urlencoded::parse(query.as_bytes()) {
278278
let name = name.into_owned();
279279
let value = value.into_owned();
280-
if params.insert(name.clone(), value).is_some() {
280+
if params.contains_key(&name) {
281281
return Err(bad_request_response(&format!(
282282
"query parameter `{name}` must not be repeated"
283283
)));
284284
}
285+
params.insert(name, value);
285286
}
286287

287288
Ok(params)

src/adapters/wasm.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@ pub struct WasmInspectResponse {
9494
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9595
#[serde(rename_all = "camelCase")]
9696
pub struct WasmTransformResponse {
97-
/// Transformed output bytes. JavaScript receives this as a `Uint8Array`.
97+
/// Transformed output bytes.
98+
///
99+
/// Skipped during JSON serialization because the bytes are passed separately
100+
/// through the [`WasmTransformResponse`] getter to avoid duplicating potentially
101+
/// megabytes of image data inside the JSON metadata string.
102+
#[serde(skip_serializing)]
98103
pub bytes: Vec<u8>,
99104
/// Metadata describing the transformed artifact.
100105
pub artifact: WasmArtifactInfo,

0 commit comments

Comments
 (0)