Skip to content

Commit

Permalink
Merge pull request #39 from kana-rus/add_workflow_check_examples
Browse files Browse the repository at this point in the history
Add workflow check examples
  • Loading branch information
kanarus authored Dec 25, 2023
2 parents 4609f44 + af7a368 commit aeb54d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
test:
Check:
runs-on: ubuntu-latest

strategy:
Expand All @@ -24,7 +24,9 @@ jobs:
profile: minimal
override: true

- uses: actions-rs/cargo@v1
with:
command: check
args: --features rt_${{ matrix.rt }}${{ matrix.x == '' && '' || ',' }}${{ matrix.x }}${{ matrix.toolchain == 'nightly' && ',nightly' || '' }},DEBUG
- name: Check ohkami's buildability
run: cargo check --features rt_${{ matrix.rt }}${{ matrix.x == '' && '' || ',' }}${{ matrix.x }}${{ matrix.toolchain == 'nightly' && ',nightly' || '' }},DEBUG

- name: Check examples' buildablity
working-directory: examples
run: cargo check
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main

jobs:
test:
Test:
runs-on: ubuntu-latest

strategy:
Expand Down
8 changes: 2 additions & 6 deletions examples/hello/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -70,16 +70,14 @@ mod fangs {
[current headers]\n\
{:?}\
", c.headers);

req
})
}
}

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();

Expand All @@ -88,8 +86,6 @@ mod fangs {
[ method ] {__method__}\n\
[ path ] {__path__}\n\
");

req
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion ohkami_macros/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn impl_payload_formdata(data: &ItemStruct) -> Result<TokenStream> {
fn parse(req: &::ohkami::Request) -> ::std::result::Result<Self, ::std::borrow::Cow<'static, str>> {
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
Expand Down

0 comments on commit aeb54d8

Please sign in to comment.