Skip to content

Commit 3caa249

Browse files
author
Anatoliy Ostapenko
committed
Add uploadCredentials option
1 parent 1b3af7a commit 3caa249

9 files changed

+48
-13
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,20 @@ var xhr = FileAPI.upload({
385385

386386
---
387387

388+
<a name="options.uploadCredentials"></a>
389+
### uploadCredentials`:Boolean`
390+
Pass credentials to upload request, HTML5 only.
391+
392+
```js
393+
var xhr = FileAPI.upload({
394+
url: '...',
395+
uploadCredentials: false,
396+
files: { .. },
397+
});
398+
```
399+
400+
---
401+
388402
<a name="options.headers"></a>
389403
### headers`:Object`
390404
Additional request headers, HTML5 only.

README.ru.md

+15
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ var xhr = FileAPI.upload({
366366
```
367367

368368
---
369+
369370
<a name="options.uploadMethod"></a>
370371
### uploadMethod`:String`
371372
Метод запроса, только HTML5.
@@ -380,6 +381,20 @@ var xhr = FileAPI.upload({
380381

381382
---
382383

384+
<a name="options.uploadCredentials"></a>
385+
### uploadCredentials`:Boolean`
386+
Передавать ли куки в запросе, только HTML5.
387+
388+
```js
389+
var xhr = FileAPI.upload({
390+
url: '...',
391+
uploadCredentials: false,
392+
files: { ... },
393+
});
394+
```
395+
396+
---
397+
383398
<a name="options.headers"></a>
384399
### headers`:Object`
385400
Дополнительные заголовки запроса, только HTML5.

dist/FileAPI.html5.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! FileAPI 2.1.0 - BSD | git://github.com/mailru/FileAPI.git
1+
/*! FileAPI 2.1.1 - BSD | git://github.com/mailru/FileAPI.git
22
* FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF.
33
*/
44

@@ -287,7 +287,7 @@
287287
* FileAPI (core object)
288288
*/
289289
api = {
290-
version: '2.1.0',
290+
version: '2.1.1',
291291

292292
cors: false,
293293
html5: true,
@@ -3001,7 +3001,9 @@
30013001

30023002
xhr.open(options.uploadMethod || 'POST', url, true);
30033003

3004-
if( api.withCredentials ){
3004+
if (typeof options.uploadCredentials === 'boolean') {
3005+
xhr.withCredentials = options.uploadCredentials ? 'true' : null;
3006+
} else if( api.withCredentials ){
30053007
xhr.withCredentials = "true";
30063008
}
30073009

dist/FileAPI.html5.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/FileAPI.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! FileAPI 2.1.0 - BSD | git://github.com/mailru/FileAPI.git
1+
/*! FileAPI 2.1.1 - BSD | git://github.com/mailru/FileAPI.git
22
* FileAPI — a set of javascript tools for working with files. Multiupload, drag'n'drop and chunked file upload. Images: crop, resize and auto orientation by EXIF.
33
*/
44

@@ -287,7 +287,7 @@
287287
* FileAPI (core object)
288288
*/
289289
api = {
290-
version: '2.1.0',
290+
version: '2.1.1',
291291

292292
cors: false,
293293
html5: true,
@@ -3001,7 +3001,9 @@
30013001

30023002
xhr.open(options.uploadMethod || 'POST', url, true);
30033003

3004-
if( api.withCredentials ){
3004+
if (typeof options.uploadCredentials === 'boolean') {
3005+
xhr.withCredentials = options.uploadCredentials ? 'true' : null;
3006+
} else if( api.withCredentials ){
30053007
xhr.withCredentials = "true";
30063008
}
30073009

dist/FileAPI.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/FileAPI.XHR.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@
200200

201201
xhr.open(options.uploadMethod || 'POST', url, true);
202202

203-
if( api.withCredentials ){
203+
if (typeof options.uploadCredentials === 'boolean') {
204+
xhr.withCredentials = options.uploadCredentials ? 'true' : null;
205+
} else if( api.withCredentials ){
204206
xhr.withCredentials = "true";
205207
}
206208

lib/FileAPI.core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
* FileAPI (core object)
194194
*/
195195
api = {
196-
version: '2.1.0',
196+
version: '2.1.1',
197197

198198
cors: false,
199199
html5: true,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "fileapi",
33
"exportName": "FileAPI",
4-
"version": "2.1.0",
4+
"version": "2.1.1",
55
"devDependencies": {
66
"connect-busboy": "~0.0.2",
77
"eventemitter2": "~0.4.13",

0 commit comments

Comments
 (0)