Skip to content

Commit 2865580

Browse files
committed
PR feedback
Signed-off-by: Ryan Levick <[email protected]>
1 parent 0520a10 commit 2865580

File tree

4 files changed

+5
-28
lines changed

4 files changed

+5
-28
lines changed

examples/python/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ component for serving static files.
1414
- [wac](https://github.com/bytecodealliance/wac)
1515
- [Python](https://www.python.org/downloads/) 3.11 or later
1616
- [pip](https://pip.pypa.io/en/stable/installation/)
17-
- [componentize-py](https://pypi.org/project/componentize-py/)
17+
- [componentize-py](https://pypi.org/project/componentize-py/) 0.13.x
1818
- [curl](https://curl.se/download.html) or a web browser for testing
1919

2020
Once you have Rust, Python, and pip installed, the following should give you everything else:
@@ -23,7 +23,7 @@ Once you have Rust, Python, and pip installed, the following should give you eve
2323
rustup target add wasm32-wasi
2424
cargo install cargo-component
2525
cargo install wac-cli
26-
pip install componentize-py
26+
pip install componentize-py=0.13.5
2727
```
2828

2929
## Building and Running

examples/rust/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ mod bindings {
2121
async fn handle_request(request: IncomingRequest, response_out: ResponseOutparam) {
2222
match (request.method(), request.path_with_query().as_deref()) {
2323
(Method::Get, Some("/hello")) => {
24-
let fields = Fields::new();
25-
fields
26-
.append(&"content-type".to_owned(), &b"text/plain".to_vec())
27-
.unwrap();
24+
let fields =
25+
Fields::from_list(&[("content-type".to_owned(), b"text/plain".to_vec())]).unwrap();
2826
let response = OutgoingResponse::new(fields);
2927

3028
let mut body = response.take_body();

src/bindings.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,7 @@ async fn handle_request(req: IncomingRequest, res_out: ResponseOutparam) {
235235
.unwrap_or(b"");
236236
match FileServer::make_response(path, enc, if_none_match) {
237237
Ok((status, headers, reader)) => {
238-
let fields = Fields::new();
239-
for (name, value) in headers {
240-
let _ = fields.append(&name, &value);
241-
}
238+
let fields = Fields::from_list(&headers).unwrap();
242239
let res = OutgoingResponse::new(fields);
243240
let _ = res.set_status_code(status.as_u16());
244241
let mut body = res.take_body();

0 commit comments

Comments
 (0)