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

to_string should add a \n to the end of the json #1163

Open
Redhawk18 opened this issue Aug 1, 2024 · 1 comment
Open

to_string should add a \n to the end of the json #1163

Redhawk18 opened this issue Aug 1, 2024 · 1 comment

Comments

@Redhawk18
Copy link

Hey there! I'm here because I had a bug today that caused the server I was sending a the json to think I was sending a never ending message because I assume how that server parses jsons includes the new line as the end of the json.

For reference this is the code that didn't work

        stream
            .write_all(to_string(&self).unwrap()).as_bytes())
            .await;

And here's the code that did

        stream
            .write_all((to_string(&self).unwrap() + "\n").as_bytes())
            .await;
@jendrikw
Copy link

jendrikw commented Aug 1, 2024

The JSON standard requires no such thing. It may be that the stream requires newline-terminated messages or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants