graphql-rust / juniper

GraphQL server library for Rust
Other
5.72k stars 425 forks source link

Add support for `Request<T>` where `T` is a type that implements `hyper::body::Body` trait #1263

Closed elcharitas closed 1 month ago

elcharitas commented 5 months ago

Should resolve #1102

Problem

Attempts to use any other hyper request type aside Request<hyper::body::Incoming> fails with a compile-time error of type mismatch

Solution

Add generic support for valid supported hyper Request or any custom Request that has a body which implements hyper::body::Body

Checklist

  • [x] Tests are added
  • [x] CHANGELOG entry is added
  • [x] ~Documentation is updated~ (not required)
elcharitas commented 5 months ago

CI Checks seem to fail and this is weird since the issues arise from the juniper crate.

Any pointers?

elcharitas commented 3 months ago

Thank you for the PR, sorry for the slow response! Are there backward compat considerations here? I see you have a default type but I am not sure. Also, can you add a test so we can be sure this doesn't regress?

Thanks for checking in. To answer your concerns..

Are there backward compat considerations here?

Yes, this PR is fully backward compatible. How do we know? There's a test already included here and it passes with no need for further configuration.

can you add a test so we can be sure this doesn't regress

Yes I can add a test for custom Request<T> type. However, I must point out that this PR makes no algo change whatsoever, it only allows passing generic request types making juniper compatible with different request types.

tyranron commented 2 months ago

@elcharitas @LegNeato I'll look into it too in the next few working days.