mirror of
https://github.com/tokio-rs/axum.git
synced 2025-01-19 07:33:11 +01:00
Don't drop leading spaces in SSE responses (#600)
* Don't drop leading spaces in SSE responses * Mention leading space fix in changelog Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
This commit is contained in:
parent
980a0a466e
commit
d9bf100216
2 changed files with 15 additions and 3 deletions
|
@ -7,11 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
# Unreleased
|
||||
|
||||
- **fixed:** `sse::Event` will no longer drop the leading space of data, event ID and name values
|
||||
that have it ([#600])
|
||||
- **fixed:** `sse::Event` is more strict about what field values it supports, disallowing any SSE
|
||||
events that break the specification (such as field values containing carriage returns) ([#599])
|
||||
- **added:** `axum::AddExtension::layer` ([#607])
|
||||
|
||||
[#599]: https://github.com/tokio-rs/axum/pull/599
|
||||
[#600]: https://github.com/tokio-rs/axum/pull/600
|
||||
[#607]: https://github.com/tokio-rs/axum/pull/607
|
||||
|
||||
# 0.4.2 (06. December, 2021)
|
||||
|
|
|
@ -452,3 +452,12 @@ impl KeepAliveStream {
|
|||
Poll::Ready(event)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn leading_space_is_not_stripped() {
|
||||
let no_leading_space = Event::default().data("\tfoobar");
|
||||
assert_eq!(no_leading_space.to_string(), "data: \tfoobar\n\n");
|
||||
|
||||
let leading_space = Event::default().data(" foobar");
|
||||
assert_eq!(leading_space.to_string(), "data: foobar\n\n");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue