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

Gloo-net Missing custom headers when sending post request. #263

Open
ITUserG01 opened this issue Nov 2, 2022 · 2 comments
Open

Gloo-net Missing custom headers when sending post request. #263

ITUserG01 opened this issue Nov 2, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@ITUserG01
Copy link

Describe the Bug

While using yew gloo_net will not add in any custom user defined headers.

This is needed for calling surrealdb's REST API which requires custom headers: "NS" for namespace selection and "DB" for database selection.

A clear and concise description of what the bug is.
Testing on Firefox V106.0.3 using yew V0.19.3

Steps to Reproduce

While inside an async function call Request::new()
let resquest = gloo_net::http::Request::new(&URL) .header("NS", "my_namespace") .header("DB", "my_namespace") .header("Accept", "application/json") .body(wasm_bindgen::JsValue::from_str("SELECT * FROM User")) .mode(RequestMode::NoCors) [.method(Method::POST)](url) .send() [.await;]

If applicable, add a link to a test case (as a zip file or link to a repository
we can clone).

Expected Behavior

Sends requested user defined headers inside from browser to DB.

Actual Behavior

Does not send user defined header from browser to DB.

wasm

Additional Context

Thank you for the help!
It is much appreciated.

@ITUserG01 ITUserG01 added the bug Something isn't working label Nov 2, 2022
@Dyhr
Copy link

Dyhr commented Jan 23, 2023

I seem to be having the same issue

@Dyhr
Copy link

Dyhr commented Jan 25, 2023

@ITUserG01 it seemed to be a CORS issue for me. I was able to solve it by running my services through the same server, but configuring CORS correctly is probably the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants