devashishdxt / tonic-web-wasm-client

Other
104 stars 28 forks source link

no method named `fetch_credentials_same_origin` found for struct `RequestBuilder` in the current scope #1

Closed andoriyu closed 2 years ago

andoriyu commented 2 years ago

In 0.1.1:

error[E0599]: no method named `fetch_credentials_same_origin` found for struct `RequestBuilder` in the current scope
  --> /home/andoriyu/.cargo/registry/src/github.com-1ecc6299db9ec823/tonic-web-wasm-client-0.1.1/src/client.rs:60:10
   |
60 |         .fetch_credentials_same_origin();
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in `RequestBuilder`
devashishdxt commented 2 years ago

Try building it with --target wasm32-unknown-unknown. This crate is only for use in browsers using wasm.

andoriyu commented 2 years ago

Try building it with --target wasm32-unknown-unknown. This crate is only for use in browsers using wasm.

@devashishdxt oh weird. My wasm crate is just in workspace with other crates and cargo check generally just worked fine. Anyways, setting target fixed it.

Any reason you've switched from web-sys's fetch api to reqwest in this fork?

devashishdxt commented 2 years ago

Any reason you've switched from web-sys's fetch api to reqwest in this fork?

reqwest internally uses fetch API. I preferred it because it has a clean and easy to use API.

devashishdxt commented 2 years ago

In addition to that, it'll be easy to extend this crate in future for use outside of browsers to connect to grpc-web servers.

andoriyu commented 2 years ago

@devashishdxt would you mind if I mark wasm-only stuff to be compiled only on wasm32-unknown-unknown target? I have a workspace that has wasm and not wasm crates, right now, it can't be built.

per-pacakge-target is still an unstable feature.

devashishdxt commented 2 years ago

I'm not sure what you mean by "mark wasm-only stuff to compile". Can you create a PR? So that I can review?