hi, I'm trying to understand this error from githu...
# ktor
b
hi, I'm trying to understand this error from github: > Client request(POST https://uploads.github.com/repos/BernhardPosselt/foundryvtt-kotlin/releases/177235411/assets?name=release.zip) invalid: 400 Bad Request. Text: "{"message":"Bad Content-Length","request_id":"A6D431B9172831472B039666F66B11"}" That's my client code that produces the error:
Copy code
client.post("<https://uploads.github.com/repos/BernhardPosselt/foundryvtt-kotlin/releases/177235411/assets?name=release.zip>") {
                url {
                    parameters.append("name", "release.zip")
                }
                contentLength()
                contentType(ContentType.Application.Zip)
                accept(ContentType.Application.Json)
                bearerAuth(githubToken)
                setBody(archive.readChannel())
            }
and this is the working curl call:
Copy code
curl -L \
  -X POST \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $GITHUB_TOKEN" \
  -H "Content-Type: application/zip" \
  "<https://uploads.github.com/repos/BernhardPosselt/foundryvtt-kotlin/releases/177235411/assets?name=release.zip>" \
  --data-binary "@build/release.zip"
Is filechannel the issue since that does not read the entire file into memory? Edit: Ok, looks like Content-Length is not set Edit 2: Setting Content-Length headers manually made it work
1