Skip to content

Commit e934deb

Browse files
Support POST method when download is true
1 parent 7ec146c commit e934deb

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

docs/docs.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ <h5 id="config-default">Default Config With All Options</h5>
433433
error: undefined,
434434
download: false,
435435
downloadRequestHeaders: undefined,
436+
downloadRequestBody: undefined,
436437
skipEmptyLines: false,
437438
chunk: undefined,
438439
fastMode: undefined,
@@ -598,6 +599,14 @@ <h5 id="config-details">Config Options</h5>
598599
}</code>
599600
</pre>
600601
</tr>
602+
<tr>
603+
<td>
604+
<code>downloadRequestBody</code>
605+
</td>
606+
<td>
607+
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.
608+
</td>
609+
</tr>
601610
<tr>
602611
<td>
603612
<code>skipEmptyLines</code>

papaparse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ License: MIT
642642
xhr.onerror = bindFunction(this._chunkError, this);
643643
}
644644

645-
xhr.open('GET', this._input, !IS_WORKER);
645+
xhr.open(this._config.downloadRequestBody ? 'POST' : 'GET', this._input, !IS_WORKER);
646646
// Headers can only be set when once the request state is OPENED
647647
if (this._config.downloadRequestHeaders)
648648
{
@@ -661,7 +661,7 @@ License: MIT
661661
}
662662

663663
try {
664-
xhr.send();
664+
xhr.send(this._config.downloadRequestBody);
665665
}
666666
catch (err) {
667667
this._chunkError(err.message);

0 commit comments

Comments
 (0)