-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 support for a HTTP body #139
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be implemented in egui_glium/src/http.rs
The CI wasn't configured to actually test the http
feature, but that has now been fixed, so please rebase on latest master
to get this PR tested by the CI.
Also: please test this manually with an actual HTTP request. I would assume most HTTP servers would also require a Content-Type
header?
egui_web/src/http.rs
Outdated
@@ -24,6 +24,10 @@ async fn fetch_jsvalue(request: &Request) -> Result<Response, JsValue> { | |||
opts.method(method); | |||
opts.mode(web_sys::RequestMode::Cors); | |||
|
|||
if method == &"POST".to_string() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method == "POST"
should work fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested manually with my personal development http server. I use kore from kore.io.
By default the Content-Type is plain/text. If we would send binary data then we need to change it, but since web_sys only has the body referenced by JsValue (and I am new to Rust - less than a week) I believe that we need only to send it if we want to change.
I the GLIUM version since it uses ureq it has the separate functions to send binary, text, form or json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tested manually with my personal development http server.
Great! Web or glium version or both?
I am new to Rust - less than a week
Wow! Good work on this PR, and welcome to the wonderful world of Rust!
Co-authored-by: Emil Ernerfeldt <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Starting to look good!
well that last commit was meant to have a proper commit message 🙄 sorry about that :) |
Thank you! |
Hi emilk,
here is the PR.
Regards,
Paulo Melo