Skip to content

Commit

Permalink
I was passing the Accept header instead of Content-Type
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-F-Bryan committed Nov 8, 2023
1 parent c5839c1 commit bca53d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions lib/cli/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct ConfigAuthentication {

impl Authentication for ConfigAuthentication {
fn get_token(&self, url: &str) -> Result<Option<String>, anyhow::Error> {
dbg!(url);
let config = WasmerConfig::from_file(&self.wasmer_dir).map_err(anyhow::Error::msg)?;

let mut url = Url::parse(url).context("Unable to parse the URL")?;
Expand All @@ -36,14 +35,14 @@ impl Authentication for ConfigAuthentication {

// Check if the user probably passed in --token because we may be
// talking to their default registry.
if let Some((default_registry, token)) = dbg!(&self.default_registry_and_token) {
if let Some((default_registry, token)) = &self.default_registry_and_token {
if registry_url == default_registry.as_str() {
return Ok(Some(token.clone()));
}
}

// Otherwise, we'll need to iterate through all known tokens.
if let Some(token) = dbg!(config.registry.get_login_token_for_registry(&registry_url)) {
if let Some(token) = config.registry.get_login_token_for_registry(&registry_url) {
return Ok(Some(token));
}

Expand Down
4 changes: 2 additions & 2 deletions lib/wasix/src/runtime/resolver/wapm_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl WapmSource {

fn headers(&self, url: &str) -> HeaderMap {
let mut headers = HeaderMap::new();
headers.insert("Accept", "application/json".parse().unwrap());
headers.insert("Content-Type", "application/json".parse().unwrap());
headers.insert("User-Agent", USER_AGENT.parse().unwrap());

if let Some(auth) = self.auth.as_deref() {
Expand All @@ -159,7 +159,7 @@ impl WapmSource {
}
}

dbg!(headers)
headers
}
}

Expand Down

0 comments on commit bca53d2

Please sign in to comment.