Skip to content

Commit

Permalink
perf: use abbreviated json
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Sep 25, 2024
1 parent 5dcb687 commit 51bb919
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion crates/registry/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ impl Package {
let network_error = |error| NetworkError { error, url: url() };
http_client
.run_with_permit(|client| {
client.get(url()).header("content-type", "application/json").send()
client
.get(url())
.header(
"accept",
"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
)
.send()
})
.await
.map_err(network_error)?
Expand Down
8 changes: 7 additions & 1 deletion crates/registry/src/package_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ impl PackageVersion {

http_client
.run_with_permit(|client| {
client.get(url()).header("content-type", "application/json").send()
client
.get(url())
.header(
"accept",
"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
)
.send()
})
.await
.map_err(network_error)?
Expand Down

0 comments on commit 51bb919

Please sign in to comment.