Skip to content

Commit

Permalink
fix(ureq): handle json correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Jan 31, 2025
1 parent 39326de commit ca89a3c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 55 deletions.
53 changes: 0 additions & 53 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ optional = true
[dependencies.ureq]
version = "3.0.0"
default-features = false
features = ["rustls", "json"]
features = ["rustls"]
optional = true

[dev-dependencies]
Expand Down
1 change: 1 addition & 0 deletions examples/custom_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fn main() {

fn custom_client() -> Api {
let config = frankenstein::ureq::Agent::config_builder()
.http_status_as_error(false)
.timeout_global(Some(Duration::from_secs(100)))
.build();
let request_agent = frankenstein::ureq::Agent::new_with_config(config);
Expand Down
7 changes: 6 additions & 1 deletion src/client_ureq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ impl TelegramApi for Api {
None => request.send_empty()?,
Some(data) => {
let json = crate::json::encode(&data)?;
request.send(&json)?
request
.header(
ureq::http::header::CONTENT_TYPE,
ureq::http::HeaderValue::from_static("application/json; charset=utf-8"),
)
.send(&json)?
}
};
Self::decode_response(response)
Expand Down

0 comments on commit ca89a3c

Please sign in to comment.