Browse Source

Support POST method when download is true

pull/779/head
DanzelTaccayan 5 years ago committed by GitHub
parent
commit
e934deb1f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      docs/docs.html
  2. 4
      papaparse.js

9
docs/docs.html

@ -433,6 +433,7 @@ var csv = Papa.unparse({ @@ -433,6 +433,7 @@ var csv = Papa.unparse({
error: undefined,
download: false,
downloadRequestHeaders: undefined,
downloadRequestBody: undefined,
skipEmptyLines: false,
chunk: undefined,
fastMode: undefined,
@ -598,6 +599,14 @@ var csv = Papa.unparse({ @@ -598,6 +599,14 @@ var csv = Papa.unparse({
}</code>
</pre>
</tr>
<tr>
<td>
<code>downloadRequestBody</code>
</td>
<td>
If defined and the download property is true, a POST request will be made instead of a GET request and the passed argument will be set as the body of the request.
</td>
</tr>
<tr>
<td>
<code>skipEmptyLines</code>

4
papaparse.js

@ -642,7 +642,7 @@ License: MIT @@ -642,7 +642,7 @@ License: MIT
xhr.onerror = bindFunction(this._chunkError, this);
}
xhr.open('GET', this._input, !IS_WORKER);
xhr.open(this._config.downloadRequestBody ? 'POST' : 'GET', this._input, !IS_WORKER);
// Headers can only be set when once the request state is OPENED
if (this._config.downloadRequestHeaders)
{
@ -661,7 +661,7 @@ License: MIT @@ -661,7 +661,7 @@ License: MIT
}
try {
xhr.send();
xhr.send(this._config.downloadRequestBody);
}
catch (err) {
this._chunkError(err.message);

Loading…
Cancel
Save