Skip to content

Commit

Permalink
back to get
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman committed Dec 6, 2022
1 parent aa84b46 commit 488ed62
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/turbo-updater/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ struct NPMRegistry;
impl Registry for NPMRegistry {
const NAME: &'static str = "npm_registry";
fn get_latest_version(pkg: &Package, _timeout: Duration) -> UpdateResult<Option<String>> {
let url = "https://turbo.build/api/binaries/version";
let data = ureq::json!({ "name": pkg.to_string() });
let resp = ureq::post(url).timeout(_timeout).send_json(data)?;
let url = format!(
"https://turbo.build/api/binaries/version?name={name}",
name = pkg
);
let resp = ureq::get(&url).timeout(_timeout).call()?;
let result = resp.into_json::<NpmVersionData>().unwrap();
Ok(Some(result.version))
}
Expand Down

0 comments on commit 488ed62

Please sign in to comment.