Skip to content

Commit

Permalink
Fix: examples, #[Payload(FormData)]
Browse files Browse the repository at this point in the history
  • Loading branch information
kanarus committed Dec 25, 2023
1 parent f64d1c9 commit af7a368
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .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 Down
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 af7a368

Please sign in to comment.