Code Monkey home page Code Monkey logo

Comments (6)

ollyde avatar ollyde commented on June 9, 2024

Also the base example is broken

Screenshot 2024-01-28 at 15 17 30

from salvo.

chrislearn avatar chrislearn commented on June 9, 2024

Are you updated to latest version?

from salvo.

ollyde avatar ollyde commented on June 9, 2024

@chrislearn upgrading to the latest version causes tons of library bugs. Here is my cargo with the latest. I have to use 0.63.1.

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
  --> /Users/oliverdixon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/salvo_core-0.65.1/src/test/response.rs:83:85
   |
83 |         let full = self.take_bytes(Some(&"application/json".parse().unwrap())).await?;
   |                                                                                     ^ doesn't have a size known at compile-time
   |
   = help: the trait `Sized` is not implemented for `[u8]`
note: required by a bound in `Break`
  --> /Users/oliverdixon/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/control_flow.rs:85:25
   |
85 | pub enum ControlFlow<B, C = ()> {
   |                         ^^^^^^ required by this bound in `Break`
...
93 |     Break(B),
   |     ----- required by a bound in this variant

from salvo.

ollyde avatar ollyde commented on June 9, 2024

@chrislearn I upgraded Rust, but I got some new errors, not sure how to solve as there's no examples (still not solved the CORS issue)

Screenshot 2024-01-28 at 15 27 39

from salvo.

ollyde avatar ollyde commented on June 9, 2024

@chrislearn thanks I fixed it. I just removed this code, seems to work without default source.

Just Rust update, and make sure to hoop at end of service.

Of course I wont' be using "*"

let cors = Cors::new()
        .allow_origin("*")
        .allow_methods(vec![Method::GET, Method::POST, Method::DELETE])
        .allow_headers(AllowHeaders::list(vec![
            HeaderName::from_static("content-type"),
            HeaderName::from_static("authorization"),
            HeaderName::from_static("device-id"),
        ]))
        .into_handler();

    let service = Service::new(router).hoop(cors);

    Server::new(acceptor).serve(service).await;

from salvo.

chrislearn avatar chrislearn commented on June 9, 2024

If you are sure this is salvo bug. please give a minimal reproduce demo.

from salvo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.