Skip to content

Commit 49251c9

Browse files
committed
publish: always specify 'host_type'
1 parent e9d36c6 commit 49251c9

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

crates/cli/src/subcommands/publish.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E
124124
// Optionally build the program.
125125
let (path_to_program, host_type) = if let Some(path) = wasm_file {
126126
println!("(WASM) Skipping build. Instead we are publishing {}", path.display());
127-
(path.clone(), None)
127+
(path.clone(), "Wasm")
128128
} else if let Some(path) = js_file {
129129
println!("(JS) Skipping build. Instead we are publishing {}", path.display());
130-
(path.clone(), Some("Js"))
130+
(path.clone(), "Js")
131131
} else {
132132
let path = build::exec_with_argstring(config.clone(), path_to_project, build_options).await?;
133-
(path, None)
133+
(path, "Wasm")
134134
};
135135
let program_bytes = fs::read(path_to_program)?;
136136

@@ -205,15 +205,13 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E
205205
builder = builder.query(&[("num_replicas", *n)]);
206206
}
207207

208-
// The host type is not the default (WASM).
209-
if let Some(host_type) = host_type {
210-
builder = builder.query(&[("host_type", host_type)]);
211-
}
212-
213208
println!("Publishing module...");
214209

215210
builder = add_auth_header_opt(builder, &auth_header);
216211

212+
// Set the host type.
213+
builder = builder.query(&[("host_type", host_type)]);
214+
217215
let res = builder.body(program_bytes).send().await?;
218216
if res.status() == StatusCode::UNAUTHORIZED && !anon_identity {
219217
// If we're not in the `anon_identity` case, then we have already forced the user to log in above (using `get_auth_header`), so this should be safe to unwrap.

0 commit comments

Comments
 (0)