Skip to content

Commit 51bb919

Browse files
committed
perf: use abbreviated json
1 parent 5dcb687 commit 51bb919

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

crates/registry/src/package.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ impl Package {
3636
let network_error = |error| NetworkError { error, url: url() };
3737
http_client
3838
.run_with_permit(|client| {
39-
client.get(url()).header("content-type", "application/json").send()
39+
client
40+
.get(url())
41+
.header(
42+
"accept",
43+
"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
44+
)
45+
.send()
4046
})
4147
.await
4248
.map_err(network_error)?

crates/registry/src/package_version.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ impl PackageVersion {
3535

3636
http_client
3737
.run_with_permit(|client| {
38-
client.get(url()).header("content-type", "application/json").send()
38+
client
39+
.get(url())
40+
.header(
41+
"accept",
42+
"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*",
43+
)
44+
.send()
3945
})
4046
.await
4147
.map_err(network_error)?

0 commit comments

Comments
 (0)