fix: use readableWebStream() to stream asset contents

This allows the uploads to finish without mismatched Content-Length,
likely because the original method implied a wrong body encoding or
something similar. Unfortunately a GitHub server API mock was not
readily available so I had to test manually with a barebones repository.

Fixes: #555
Fixes: #556
Signed-off-by: WANG Xuerui <git@xen0n.name>
This commit is contained in:
WANG Xuerui 2024-12-23 15:02:18 +08:00
parent 92dffe6c28
commit 0b3b1e3ef6
No known key found for this signature in database
GPG key ID: 99797B0EB13A6337
3 changed files with 28 additions and 25 deletions

View file

@ -14,11 +14,10 @@ describe("github", () => {
describe("asset", () => {
it("derives asset info from a path", async () => {
const { name, mime, size, data } = asset("tests/data/foo/bar.txt");
const { name, mime, size } = asset("tests/data/foo/bar.txt");
assert.equal(name, "bar.txt");
assert.equal(mime, "text/plain");
assert.equal(size, 10);
assert.equal(await text(data), "release me");
});
});
});