Skip to content

Commit ad9346f

Browse files
authored
feat: upgrade urllib to 4.x (#26)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Updated Node.js engine requirement to version 18.19.0 or higher. - Upgraded `urllib` dependency to version 4.6.2. - **Chores** - Adjusted CI workflow to remove Node.js version 16 from testing matrix, focusing on versions 18, 20, 22, and 23. - **Tests** - Modified test suite for `OSSObject` class, focusing on the `copy()` method and maintaining core functionality checks, including tests for non-English names and metadata handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent b384e48 commit ad9346f

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
node-version: [16, 18, 20, 22, 23]
21+
node-version: [18, 20, 22, 23]
2222
os: [ubuntu-latest]
2323

2424
steps:

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"ms": "^2.1.3",
3535
"oss-interface": "^1.3.0",
3636
"stream-wormhole": "^2.0.0",
37-
"urllib": "^3.19.2",
37+
"urllib": "^4.6.2",
3838
"utility": "^2.1.0",
3939
"xml2js": "^0.6.2"
4040
},

test/OSSObject.test.ts

+25-22
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ describe('test/OSSObject.test.ts', () => {
5353
}
5454

5555
it('should list with query', async () => {
56-
const result = await ossObject.list();
56+
const result = await ossObject.list({
57+
prefix: listPrefix,
58+
'max-keys': 5,
59+
});
5760
assert(result.objects.length > 0);
5861
// console.log(result.objects);
5962
result.objects.map(checkObjectProperties);
@@ -1728,8 +1731,8 @@ describe('test/OSSObject.test.ts', () => {
17281731
describe('copy()', () => {
17291732
let name: string;
17301733
let resHeaders: IncomingHttpHeaders;
1731-
let otherBucket: string;
1732-
let otherBucketObject: string;
1734+
// let otherBucket: string;
1735+
// let otherBucketObject: string;
17331736
before(async () => {
17341737
name = `${prefix}oss-client/oss/copy-meta.js`;
17351738
const object = await ossObject.put(name, __filename, {
@@ -1783,25 +1786,25 @@ describe('test/OSSObject.test.ts', () => {
17831786
assert.strictEqual(res.headers['content-disposition'], disposition);
17841787
});
17851788

1786-
it.skip('should copy object from other bucket, sourceBucket in copySource', async () => {
1787-
const copySource = `/${otherBucket}/${otherBucketObject}`;
1788-
const copyTarget = `${prefix}oss-client/oss/copy-target.js`;
1789-
const result = await ossObject.copy(copyTarget, copySource);
1790-
assert.equal(result.res.status, 200);
1791-
1792-
const info = await ossObject.head(copyTarget);
1793-
assert.equal(info.status, 200);
1794-
});
1795-
1796-
it.skip('should copy object from other bucket, sourceBucket is a separate parameter', async () => {
1797-
const copySource = otherBucketObject;
1798-
const copyTarget = `${prefix}oss-client/oss/has-bucket-name-copy-target.js`;
1799-
const result = await ossObject.copy(copyTarget, copySource, otherBucket);
1800-
assert.equal(result.res.status, 200);
1801-
1802-
const info = await ossObject.head(copyTarget);
1803-
assert.equal(info.status, 200);
1804-
});
1789+
// it.skip('should copy object from other bucket, sourceBucket in copySource', async () => {
1790+
// const copySource = `/${otherBucket}/${otherBucketObject}`;
1791+
// const copyTarget = `${prefix}oss-client/oss/copy-target.js`;
1792+
// const result = await ossObject.copy(copyTarget, copySource);
1793+
// assert.equal(result.res.status, 200);
1794+
//
1795+
// const info = await ossObject.head(copyTarget);
1796+
// assert.equal(info.status, 200);
1797+
// });
1798+
1799+
// it.skip('should copy object from other bucket, sourceBucket is a separate parameter', async () => {
1800+
// const copySource = otherBucketObject;
1801+
// const copyTarget = `${prefix}oss-client/oss/has-bucket-name-copy-target.js`;
1802+
// const result = await ossObject.copy(copyTarget, copySource, otherBucket);
1803+
// assert.equal(result.res.status, 200);
1804+
//
1805+
// const info = await ossObject.head(copyTarget);
1806+
// assert.equal(info.status, 200);
1807+
// });
18051808

18061809
it('should copy object with non-english name', async () => {
18071810
const sourceName = `${prefix}oss-client/oss/copy-meta_测试.js`;

0 commit comments

Comments
 (0)