Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Form support (IntroResponse + FromRequest) #68

Closed
GlenDC opened this issue Feb 29, 2024 · 5 comments
Closed

add Form support (IntroResponse + FromRequest) #68

GlenDC opened this issue Feb 29, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers low prio Low priority item. mentor available A mentor is available to help you through the issue.
Milestone

Comments

@GlenDC
Copy link
Member

GlenDC commented Feb 29, 2024

Akin to the Json support it can be nice to develop and implement Form.
It would be used to:

  • be able to decode Form from the request (which is either in the payload, or it is in the query, depending on the Http Method and Content-Type header)
  • be able to return a Form response payload.

You can find inspiration here: https://docs.rs/axum/latest/src/axum/form.rs.html#73. Also look at how implement Json vs how Axum does it, to see on the differences you need to pay attention to.

Deliverables:

Low prio item, not on any roadmap for now. But a great easy one for someone of the community to pick up if they look for something to ge started.

@GlenDC GlenDC added enhancement New feature or request good first issue Good for newcomers low prio Low priority item. labels Feb 29, 2024
@GlenDC GlenDC added this to the v0.3 milestone Feb 29, 2024
@GlenDC GlenDC added the mentor available A mentor is available to help you through the issue. label Mar 15, 2024
@devanbenz
Copy link
Contributor

Could I take this one on? Saw your folks CFC in this week in rust :)

@GlenDC
Copy link
Member Author

GlenDC commented Mar 29, 2024

It is all yours @devanbenz. Welcome and thank you for your time and effort.

If you need guidance, have input, questions or anything else, feel free to ask/share here, by mail or discord. Whatever you prefer.

@devanbenz
Copy link
Contributor

@GlenDC could you assign this to me so I can tag my PR with it and it shows up in my github page easily? :) Thank you!

@GlenDC
Copy link
Member Author

GlenDC commented Apr 4, 2024

Resolved by @devanbenz in #136.

@GlenDC GlenDC closed this as completed Apr 4, 2024
@GlenDC GlenDC modified the milestones: v0.3, v0.2 Apr 4, 2024
@GlenDC
Copy link
Member Author

GlenDC commented Apr 4, 2024

@devanbenz I added some improvements on top of your great work, as it was stuff I only realised after I already merged it in, you can find the diff at 7ab08ad, summary;

  • also accept query Form data (Get request only)
  • ensure we parse body form data only when it is not a Get request (e.g. but it is a Post)
  • support an html approach as well in that same example
  • add an actual tracing subscriber (as otherwise your tracing layer will not output anything)
  • while I was at it also make it graceful, just for good practise

Your curl XPOST example didn't work as curl by default (at least on MacOS) uses multipart encoding, which is not something urlencoding can handle (as it is a very different beast). Added a new issue for that one, non-prio: #139

Feel free to pick that one up, or anything else, or nothing. All up to you.

Thank you once again for the contribution @devanbenz , have a nice day and hope to see you around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers low prio Low priority item. mentor available A mentor is available to help you through the issue.
Projects
None yet
Development

No branches or pull requests

2 participants