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

merge develop #922

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/browser/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
exports.version="6.13.0"
exports.version="6.13.1"
16 changes: 8 additions & 8 deletions test/browser/browser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const cleanBucket = async store => {
const uploads = result.uploads || [];
await Promise.all(uploads.map(_ => store.abortMultipartUpload(_.name, _.uploadId)));
};

describe('browser', () => {
/* eslint require-yield: [0] */
before(() => {
Expand All @@ -48,7 +47,6 @@ describe('browser', () => {
stsToken: stsConfig.Credentials.SecurityToken,
bucket: stsConfig.bucket
};

// this.store = oss({
// region: stsConfig.region,
// accessKeyId: creds.AccessKeyId,
Expand Down Expand Up @@ -639,8 +637,9 @@ describe('browser', () => {

describe('get()', () => {
const name = `${prefix}ali-sdk/get/${Date.now()}-oss.jpg`
const store = new OSS(ossConfig);
let store;
before(async () => {
store = new OSS(ossConfig);
await store.put(name, Buffer.from('oss.jpg'));
});
it('should get with default responseCacheControl option', async () => {
Expand Down Expand Up @@ -676,7 +675,7 @@ describe('browser', () => {
assert.equal(resultDel.res.status, 204);
});
it('GETs and PUTs blob to a bucket', async () => {
const name = `${prefix}put/test`;
const name = `${prefix}put/test1`;
const body = new Blob(['blobBody'], { type: 'text/plain' });
const resultPut = await store.put(name, body);
assert.equal(resultPut.res.status, 200);
Expand Down Expand Up @@ -732,7 +731,7 @@ describe('browser', () => {

it('should set custom Content-MD5 and ignore case', async () => {
const name = `${prefix}put/test-md5`;
const content = Array(1024 * 1024 * 10)
const content = Array(1024 * 1024 * 2)
.fill(1)
.join('');
const body = new Blob([content], { type: 'text/plain' });
Expand Down Expand Up @@ -906,7 +905,8 @@ describe('browser', () => {
assert.equal(typeof result.data.etag, 'string');
assert.equal(typeof result.data.lastModified, 'string');
let info = await store.head(originname);
assert(!info.res.headers['cache-control']);
// It should be 'no-cache' in the real browser environment, but other environments are undefined
assert(!info.res.headers['cache-control'] || info.res.headers['cache-control'] === 'no-cache');

// add Cache-Control header to a exists object
result = await store.copy(originname, originname, {
Expand Down Expand Up @@ -2079,12 +2079,12 @@ describe('browser', () => {

it('putMeta() should return 200', async () => {
const result = await store.putMeta(name, {
b: utf8_content
a: utf8_content
});
assert.equal(result.res.status, 200);
const info = await store.head(name);
assert.equal(info.status, 200);
assert.equal(info.meta.b, latin1_content);
assert.equal(info.meta.a, latin1_content);
});
});

Expand Down