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

Bug: Cannot make a request without retries #36

Open
apohrebniak opened this issue Nov 2, 2023 · 0 comments · May be fixed by #37
Open

Bug: Cannot make a request without retries #36

apohrebniak opened this issue Nov 2, 2023 · 0 comments · May be fixed by #37

Comments

@apohrebniak
Copy link

The coap_client::RequestOptions structs has a retries field that specifies a number of request retries. Following a field documentation, one might think that by setting retries: 0, the client would perform a request only once.

However, this tests succeeds:

    #[tokio::test]
    async fn would_fail() {
        let _ = SimpleLogger::init(LevelFilter::Debug, Config::default());

        let mut client = TokioClient::connect("coap://coap.me:5683", &ClientOptions::default())
            .await
            .unwrap();

        let opts = RequestOptions {
            retries: 0,
            timeout: Duration::from_secs(1000),
            ..Default::default()
        };

        let resp = client
            .get("hello", &opts)
            .await;

        assert!(resp.is_err());
        if let Err(Error::Transport(err)) = resp {
            assert_eq!(err.kind(), ErrorKind::TimedOut);
        }

        client.close().await.unwrap();
    }
apohrebniak added a commit to apohrebniak/rust-coap-client that referenced this issue Nov 2, 2023
@apohrebniak apohrebniak linked a pull request Nov 2, 2023 that will close this issue
apohrebniak added a commit to apohrebniak/rust-coap-client that referenced this issue Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant