mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-11 12:31:14 +01:00
Merge pull request #145 from SpriteOvO/fix-entity-pre
Skip the `language` field of `MessageEntityKind::Pre` if it is `None`
This commit is contained in:
commit
92070cf22f
2 changed files with 20 additions and 0 deletions
|
@ -52,12 +52,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Make `SendPoll::poll_` optional ([#133][pr133])
|
- Make `SendPoll::poll_` optional ([#133][pr133])
|
||||||
- Bug with `caption_entities`, see issue [#473][issue473]
|
- Bug with `caption_entities`, see issue [#473][issue473]
|
||||||
- Type of response for `CopyMessage` method ([#141](pr141), [#142](pr142))
|
- Type of response for `CopyMessage` method ([#141](pr141), [#142](pr142))
|
||||||
|
- Bad request serialization when the `language` field of `MessageEntityKind::Pre` is `None` ([#145](pr145))
|
||||||
|
|
||||||
[pr119]: https://github.com/teloxide/teloxide-core/pull/119
|
[pr119]: https://github.com/teloxide/teloxide-core/pull/119
|
||||||
[pr133]: https://github.com/teloxide/teloxide-core/pull/133
|
[pr133]: https://github.com/teloxide/teloxide-core/pull/133
|
||||||
[pr141]: https://github.com/teloxide/teloxide-core/pull/141
|
[pr141]: https://github.com/teloxide/teloxide-core/pull/141
|
||||||
[pr142]: https://github.com/teloxide/teloxide-core/pull/142
|
[pr142]: https://github.com/teloxide/teloxide-core/pull/142
|
||||||
[pr143]: https://github.com/teloxide/teloxide-core/pull/143
|
[pr143]: https://github.com/teloxide/teloxide-core/pull/143
|
||||||
|
[pr145]: https://github.com/teloxide/teloxide-core/pull/145
|
||||||
[issue473]: https://github.com/teloxide/teloxide/issues/473
|
[issue473]: https://github.com/teloxide/teloxide/issues/473
|
||||||
[issue427]: https://github.com/teloxide/teloxide/issues/427
|
[issue427]: https://github.com/teloxide/teloxide/issues/427
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ impl MessageEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[serde_with_macros::skip_serializing_none]
|
||||||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
|
@ -104,4 +105,21 @@ mod tests {
|
||||||
.unwrap()
|
.unwrap()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/teloxide/teloxide-core/pull/145
|
||||||
|
#[test]
|
||||||
|
fn pre_with_none_language() {
|
||||||
|
use serde_json::to_string;
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
to_string(&MessageEntity {
|
||||||
|
kind: MessageEntityKind::Pre { language: None },
|
||||||
|
offset: 1,
|
||||||
|
length: 2,
|
||||||
|
})
|
||||||
|
.unwrap()
|
||||||
|
.find("language"),
|
||||||
|
None
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue