Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Content-Length when use octokit upload asset with webStream #24197

Open
Gaubee opened this issue Jun 13, 2024 · 0 comments
Open

Bad Content-Length when use octokit upload asset with webStream #24197

Gaubee opened this issue Jun 13, 2024 · 0 comments
Labels
bug Something isn't working correctly node compat

Comments

@Gaubee
Copy link

Gaubee commented Jun 13, 2024

This code works fine

octokit.repos
      .uploadReleaseAsset({
        headers: {
          "Content-Type": mime.getType(path.extname(filepath)) || "application/octet-stream",
          "Content-Length": totalSize.toString(),
        },
        ...baseParams,
        release_id: release_id,
        name: path.basename(filepath),
        data: fs.readFileSync(filepath) as any,
      })

but not this one

octokit.repos
      .uploadReleaseAsset({
        headers: {
          "Content-Type": mime.getType(path.extname(filepath)) || "application/octet-stream",
          "Content-Length": totalSize.toString(),
        },
        ...baseParams,
        release_id: release_id,
        name: path.basename(filepath),
        data: stream.Readable.toWeb(fs.createReadStream(filepath)) as any,
      })

got error:400 HttpError: Bad Content-Length

@satyarohith satyarohith added bug Something isn't working correctly node compat labels Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

No branches or pull requests

2 participants