Skip to content

Commit

Permalink
Fix/browser test case (#920) (#922)
Browse files Browse the repository at this point in the history
* chore: mege develop (#917)

* feat: support non-english http header (#842)

* feat: support non-english http header

* test: Add test cases for non-English request header information

* feat: add headerEncoding option

* feat: add encoder types

* fix: remove object spread syntax

Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>

* fix(browser): checkpoint.file (#795)

* merge branch master into develop

* feat: inventory (#860)

* feat: worm (#857)

* feat: auto set stsConfig when sts expires (#856)

* feat: auto set stsConfig when sts expires

* test: add auto set sts test case

* fix: host err which old image client request (#869)

* fix: use put insteadof putStream when calling multipartUpload to process small file in browser (#890)

* fix(browser):setTimeout  has minimum time interval when tab is inactive (#887)

* fix: replace process for browser

* fix: use browserify options to replace process.js (#886)

Co-authored-by: beajer <919060679@qq.com>

* fix: merge conflict #726 (#892)

* fix: merge conflict

* test: ResponseTimeoutError

* fix: cannot use ali-oss in webworker (#823)

* feat: retry when net err or timeout (#876)

* feat: retry when net err or timeout

* test: should not retry when params.stream is not readable

* test: retry in browser

Co-authored-by: beajer <919060679@qq.com>

* fix: getBucketVersions should use NextKeyMarker property (#896)

* fix: getBucketVersions should use NextKeyMarker property

* docs: getBucketVersions should use NextKeyMarker property

* docs: Compatible wrong property

* Fix multipart upload (#895)

* fix: multipartUpload

zancun

* fix: test case

* test: multipartUploadStreams

* test: cov

* fix: error method

* fix: test and destory(err) when cancel

Co-authored-by: weiyie <912881342@qq.com>

* feat: listObjectsV2 (#888)

* feat: listObjectsV2

* style: trailingComma none

* fix: check region and endpoint for ssrf (#874)

* fix: check region and endpoint for ssrf

* fix: retry in browser

Co-authored-by: beajer <919060679@qq.com>

* use shime/url replace node-url to fix split regex bug

* fix: browser test and listV2 docs (#901)

* chore(release): 6.12.0

* chore: build 6.12.0

* fix: the continuation-token params in listV2 (#906)

* fix: the continuation-token params in listV2

* docs: update headers.Expires

* docs: revise `start-after` in listV2 (#907)

* fix: should use encodeURIComponent insteadof encodeURI in copy api (#914)

* fix: use lowercase header when calculating signatures (#910)

* fix: use lowercase header when calculating signatures

* fix: should throw error when neither bucket nor cname;  docs;

* fix(node): deepCopy not working for large Buffers (#909)

deepCopy does not work when copying an object
with a large Buffer (see test case).

This causes issues when using multipartUpload with the
`checkpoint` option: e.g.

```js
const file = Buffer.alloc(Math.pow(2, 30) - 1);
// throws RangeError in utils/deepCopy
multipartUpload("name", file, {checkpoint: {file, ...}});
```

* feat: prevent caching for the get api (#916)

* feat: prevent caching for the get api

* fix: support responseCacheControl for browser `get`

* fix: unnecessary query parameters

* fix: test case because Image Process updated compression algorithm

* fix: test case of buffer replication in Nodejs8

* fix: remove test.only

* fix: do not copy buffer in completeMultipartUpload (#915)

* fix: do not copy buffer in completeMultipartUpload

* fix: test case because Image Process updated compression algorithm

* fix: test case of buffer replication in Nodejs8

* fix: remove test.only

* fix: codecov

* fix: merge conflict from master

Co-authored-by: beajer <919060679@qq.com>
Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>
Co-authored-by: 冷若霜寒 <912881342@qq.com>
Co-authored-by: Alois Klink <alois.klink@gmail.com>

* chrome: build

* fix: responseCacheControl in Node.js (#919)

* fix: responseCacheControl in Node.js

* fix: code specification

* chore(release): 6.13.1

* fix: failed browser test case

Co-authored-by: 饶培泽 <peizerao@gmail.com>
Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>
Co-authored-by: 冷若霜寒 <912881342@qq.com>
Co-authored-by: Alois Klink <alois.klink@gmail.com>

Co-authored-by: beajer <919060679@qq.com>
Co-authored-by: biejia <wb-bj559483@alibaba-inc.com>
Co-authored-by: 冷若霜寒 <912881342@qq.com>
Co-authored-by: Alois Klink <alois.klink@gmail.com>
  • Loading branch information
5 people committed Jan 21, 2021
1 parent cd50f88 commit 3eb6a81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
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

0 comments on commit 3eb6a81

Please sign in to comment.