@smbcloud / smbcloud-ascapi Mirror · read-only / commits / 5044873
Fork 0

Read-only mirror of github.com/smbcloudXYZ/smbcloud-ascapi.

Mirrored from https://github.com/smbcloudXYZ/smbcloud-ascapi.git

Synced Nov 25, 09:15 UTC

Create Store submissions without a request body

An empty JSON object was read as a submission with no listings and rejected with a 400. The POST now sends no body, so the Store clones the last published submission. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Seto Elkahfi committed Oct 24, 2026 at 19:13 UTC 5044873cce6e7d55798f758df49ea953e9becdcb
1 file changed +7 -7
crates/msstore/src/client.rs
+7 -7
@@ -37,10 +37,12 @@ impl MsStoreClient {
37 let token = self.tokens.get(&self.http, &self.credentials).await?;
38 let mut request = self
39 .http
40 - .request(method, format!("{}{path}", self.root))
40 + .request(method.clone(), format!("{}{path}", self.root))
41 .bearer_auth(token);
42 if let Some(body) = body {
43 request = request.json(body);
44 + } else if method == Method::POST {
45 + request = request.header("Content-Length", "0");
46 }
47 let response = request.send().await?;
48 let status = response.status();
@@ -66,12 +68,10 @@ impl MsStoreClient {
68
69 /// Create a submission cloned from the last published one.
70 pub async fn create_submission(&self, product_id: &str) -> Result<Value> {
69 - self.send(
70 - Method::POST,
71 - &app_path(product_id, "/submissions"),
72 - Some(&Value::Object(Default::default())),
73 - )
74 - .await
71 + // No body: the API clones the last published submission, and an
72 + // empty JSON object is read as a submission with no listings.
73 + self.send(Method::POST, &app_path(product_id, "/submissions"), None)
74 + .await
75 }
76
77 pub async fn get_submission(&self, product_id: &str, submission_id: &str) -> Result<Value> {