Skip to content

Commit

Permalink
Merge pull request #425 from mailru/with-credentials-options
Browse files Browse the repository at this point in the history
Add uploadCredentials option
  • Loading branch information
RubaXa committed Jun 7, 2019
2 parents 1b3af7a + 3caa249 commit e89888f
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 13 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -385,6 +385,20 @@ var xhr = FileAPI.upload({

---

<a name="options.uploadCredentials"></a>
### uploadCredentials`:Boolean`
Pass credentials to upload request, HTML5 only.

```js
var xhr = FileAPI.upload({
url: '...',
uploadCredentials: false,
files: { .. },
});
```

---

<a name="options.headers"></a>
### headers`:Object`
Additional request headers, HTML5 only.
Expand Down
15 changes: 15 additions & 0 deletions README.ru.md
Expand Up @@ -366,6 +366,7 @@ var xhr = FileAPI.upload({
```

---

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

---

<a name="options.uploadCredentials"></a>
### uploadCredentials`:Boolean`
Передавать ли куки в запросе, только HTML5.

```js
var xhr = FileAPI.upload({
url: '...',
uploadCredentials: false,
files: { ... },
});
```

---

<a name="options.headers"></a>
### headers`:Object`
Дополнительные заголовки запроса, только HTML5.
Expand Down
8 changes: 5 additions & 3 deletions dist/FileAPI.html5.js
@@ -1,4 +1,4 @@
/*! FileAPI 2.1.0 - BSD | git://github.com/mailru/FileAPI.git
/*! FileAPI 2.1.1 - BSD | git://github.com/mailru/FileAPI.git
* 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.
*/

Expand Down Expand Up @@ -287,7 +287,7 @@
* FileAPI (core object)
*/
api = {
version: '2.1.0',
version: '2.1.1',

cors: false,
html5: true,
Expand Down Expand Up @@ -3001,7 +3001,9 @@

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

if( api.withCredentials ){
if (typeof options.uploadCredentials === 'boolean') {
xhr.withCredentials = options.uploadCredentials ? 'true' : null;
} else if( api.withCredentials ){
xhr.withCredentials = "true";
}

Expand Down
4 changes: 2 additions & 2 deletions dist/FileAPI.html5.min.js

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions dist/FileAPI.js
@@ -1,4 +1,4 @@
/*! FileAPI 2.1.0 - BSD | git://github.com/mailru/FileAPI.git
/*! FileAPI 2.1.1 - BSD | git://github.com/mailru/FileAPI.git
* 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.
*/

Expand Down Expand Up @@ -287,7 +287,7 @@
* FileAPI (core object)
*/
api = {
version: '2.1.0',
version: '2.1.1',

cors: false,
html5: true,
Expand Down Expand Up @@ -3001,7 +3001,9 @@

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

if( api.withCredentials ){
if (typeof options.uploadCredentials === 'boolean') {
xhr.withCredentials = options.uploadCredentials ? 'true' : null;
} else if( api.withCredentials ){
xhr.withCredentials = "true";
}

Expand Down
4 changes: 2 additions & 2 deletions dist/FileAPI.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion lib/FileAPI.XHR.js
Expand Up @@ -200,7 +200,9 @@

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

if( api.withCredentials ){
if (typeof options.uploadCredentials === 'boolean') {
xhr.withCredentials = options.uploadCredentials ? 'true' : null;
} else if( api.withCredentials ){
xhr.withCredentials = "true";
}

Expand Down
2 changes: 1 addition & 1 deletion lib/FileAPI.core.js
Expand Up @@ -193,7 +193,7 @@
* FileAPI (core object)
*/
api = {
version: '2.1.0',
version: '2.1.1',

cors: false,
html5: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "fileapi",
"exportName": "FileAPI",
"version": "2.1.0",
"version": "2.1.1",
"devDependencies": {
"connect-busboy": "~0.0.2",
"eventemitter2": "~0.4.13",
Expand Down

0 comments on commit e89888f

Please sign in to comment.