From 531a9ae84583cd71e10a85a9f0caa22a53b7117b Mon Sep 17 00:00:00 2001 From: kana-rus Date: Mon, 25 Dec 2023 16:29:56 +0900 Subject: [PATCH 1/4] Add: `Check examples' buidlability` step in `check.yml` --- .github/workflows/check.yml | 9 ++++++++- ohkami/Cargo.toml | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5553a2d9..9aedab34 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -24,7 +24,14 @@ jobs: profile: minimal override: true - - uses: actions-rs/cargo@v1 + - name: Check ohkami's buildability + uses: actions-rs/cargo@v1 with: command: check args: --features rt_${{ matrix.rt }}${{ matrix.x == '' && '' || ',' }}${{ matrix.x }}${{ matrix.toolchain == 'nightly' && ',nightly' || '' }},DEBUG + + - name: Check examples' buildablity + working-directory: examples + uses: actions-rs/cargo@v1 + with: + command: check diff --git a/ohkami/Cargo.toml b/ohkami/Cargo.toml index 2b7a499a..be5b147b 100644 --- a/ohkami/Cargo.toml +++ b/ohkami/Cargo.toml @@ -38,9 +38,9 @@ DEBUG = [ "tokio?/macros", "async-std?/attributes" ] -# default = [ -# "rt_tokio", -# #"rt_async-std", -# "DEBUG", -# # "nightly" -# ] \ No newline at end of file +default = [ + "rt_tokio", + #"rt_async-std", + "DEBUG", + # "nightly" +] \ No newline at end of file From b8d64359b3d679c6d4ac83b01d8a86088955f9ce Mon Sep 17 00:00:00 2001 From: kana-rus Date: Mon, 25 Dec 2023 16:30:45 +0900 Subject: [PATCH 2/4] not DEBUG --- ohkami/Cargo.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ohkami/Cargo.toml b/ohkami/Cargo.toml index be5b147b..2b7a499a 100644 --- a/ohkami/Cargo.toml +++ b/ohkami/Cargo.toml @@ -38,9 +38,9 @@ DEBUG = [ "tokio?/macros", "async-std?/attributes" ] -default = [ - "rt_tokio", - #"rt_async-std", - "DEBUG", - # "nightly" -] \ No newline at end of file +# default = [ +# "rt_tokio", +# #"rt_async-std", +# "DEBUG", +# # "nightly" +# ] \ No newline at end of file From f64d1c957b57a989cb8e8d07a51a687ccae29498 Mon Sep 17 00:00:00 2001 From: kana-rus Date: Mon, 25 Dec 2023 16:38:16 +0900 Subject: [PATCH 3/4] Fix: check.yml --- .github/workflows/check.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 9aedab34..02ee0027 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -25,13 +25,8 @@ jobs: override: true - name: Check ohkami's buildability - uses: actions-rs/cargo@v1 - with: - command: check - args: --features rt_${{ matrix.rt }}${{ matrix.x == '' && '' || ',' }}${{ matrix.x }}${{ matrix.toolchain == 'nightly' && ',nightly' || '' }},DEBUG - + run: cargo check --features rt_${{ matrix.rt }}${{ matrix.x == '' && '' || ',' }}${{ matrix.x }}${{ matrix.toolchain == 'nightly' && ',nightly' || '' }},DEBUG + - name: Check examples' buildablity working-directory: examples - uses: actions-rs/cargo@v1 - with: - command: check + run: cargo check From af7a36898f7cb5eed9d670aede6038c3b5ea17f1 Mon Sep 17 00:00:00 2001 From: kana-rus Date: Mon, 25 Dec 2023 16:44:19 +0900 Subject: [PATCH 4/4] Fix: examples, #[Payload(FormData)] --- .github/workflows/check.yml | 2 +- .github/workflows/test.yml | 2 +- examples/hello/src/main.rs | 8 ++------ ohkami_macros/src/payload.rs | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 02ee0027..be6ca521 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -6,7 +6,7 @@ on: - main jobs: - test: + Check: runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb69b3e5..8b631c50 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - main jobs: - test: + Test: runs-on: ubuntu-latest strategy: diff --git a/examples/hello/src/main.rs b/examples/hello/src/main.rs index d0016d17..9d767f4a 100644 --- a/examples/hello/src/main.rs +++ b/examples/hello/src/main.rs @@ -61,7 +61,7 @@ mod fangs { pub struct AppendServer; impl IntoFang for AppendServer { fn bite(self) -> Fang { - Fang(|c: &mut Context, req: Request| { + Fang(|c: &mut Context| { c.headers .Server("ohkami"); @@ -70,8 +70,6 @@ mod fangs { [current headers]\n\ {:?}\ ", c.headers); - - req }) } } @@ -79,7 +77,7 @@ mod fangs { pub struct LogRequest; impl IntoFang for LogRequest { fn bite(self) -> Fang { - Fang(|_: &mut Context, req: Request| { + Fang(|req: &mut Request| { let __method__ = req.method(); let __path__ = req.path(); @@ -88,8 +86,6 @@ mod fangs { [ method ] {__method__}\n\ [ path ] {__path__}\n\ "); - - req }) } } diff --git a/ohkami_macros/src/payload.rs b/ohkami_macros/src/payload.rs index 5906f99b..d8f91bde 100644 --- a/ohkami_macros/src/payload.rs +++ b/ohkami_macros/src/payload.rs @@ -190,7 +190,7 @@ fn impl_payload_formdata(data: &ItemStruct) -> Result { fn parse(req: &::ohkami::Request) -> ::std::result::Result> { let (content_type, payload) = req.payload() .ok_or_else(|| ::std::borrow::Cow::Borrowed("Expected a payload"))?; - let ::ohkami::ContentType::FormData { boundary } = content_type + let ::ohkami::http::ContentType::FormData { boundary } = content_type else {return ::std::result::Result::Err(::std::borrow::Cow::Borrowed("Expected a `multipart/form-data` payload"))}; #declaring_exprs