Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@ wildcard_dependencies = "warn"
print_stderr = "warn"
print_stdout = "warn"
dbg_macro = "warn"

[profile.release]
strip = "symbols"
codegen-units = 1
lto = true
opt-level = "z"
panic = "abort"
3 changes: 1 addition & 2 deletions rust/crates/pinget-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ clap = { version = "4.6.1", features = ["derive"] }
pinget-core = { version = "0.9.0", path = "../pinget-core" }
chrono = "0.4.44"
dirs = "6.0"
jsonschema = "0.30"
reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls"] }
jsonschema = { version = "0.30", default-features = false, features = ["resolve-file"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1.0.149"
serde_yaml = "0.9"
Expand Down
2 changes: 1 addition & 1 deletion rust/crates/pinget-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ flate2 = "1.1.9"
# those, but fancy-regex's backtracking engine does. Performance is fine for
# the one-shot normalize call per installed package.
fancy-regex = "0.16"
reqwest = { version = "0.13.2", default-features = false, features = ["blocking", "json", "query", "rustls"] }
reqwest = { version = "0.13.2", default-features = false, features = ["blocking", "query", "rustls"] }
pollster = "0.4.0"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
Expand Down
19 changes: 10 additions & 9 deletions rust/crates/pinget-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use chrono::{DateTime, Duration, Utc};
use reqwest::StatusCode;
use reqwest::blocking::{Client, Response};
use reqwest::header::{
ACCEPT_ENCODING, CONTENT_LENGTH, CONTENT_RANGE, ETAG, HeaderMap, HeaderValue, IF_MODIFIED_SINCE, IF_NONE_MATCH,
IF_RANGE, LAST_MODIFIED, RANGE,
ACCEPT_ENCODING, CONTENT_LENGTH, CONTENT_RANGE, CONTENT_TYPE, ETAG, HeaderMap, HeaderValue, IF_MODIFIED_SINCE,
IF_NONE_MATCH, IF_RANGE, LAST_MODIFIED, RANGE,
};
use serde::{Deserialize, Serialize};
use serde_json::{Map as JsonMap, Value as JsonValue};
Expand Down Expand Up @@ -3121,14 +3121,15 @@ impl Repository {
.client
.post(url)
.header("Version", contract)
.json(&body)
.header(CONTENT_TYPE, "application/json")
.body(serde_json::to_vec(&body).context("failed to serialize REST search request")?)
.send()
.context("REST search request failed")?
.error_for_status()
.context("REST search request returned an error")?;
let json = response
.json::<JsonValue>()
.context("failed to parse REST search response")?;
let json =
serde_json::from_slice::<JsonValue>(&response.bytes().context("failed to read REST search response")?)
.context("failed to parse REST search response")?;
let data = json
.get("Data")
.and_then(JsonValue::as_array)
Expand Down Expand Up @@ -3455,9 +3456,9 @@ impl Repository {
.context("REST information request returned an error")?;

let max_age = cache_control_max_age(&response);
let json = response
.json::<JsonValue>()
.context("failed to parse REST information response")?;
let json =
serde_json::from_slice::<JsonValue>(&response.bytes().context("failed to read REST information response")?)
.context("failed to parse REST information response")?;
let data = json
.get("Data")
.cloned()
Expand Down
Loading