add multipart/form-data support to http request node

This commit is contained in:
Nick Kasten
2019-03-05 09:55:21 -06:00
parent a6ef755139
commit a9bf3d0226
2 changed files with 35 additions and 18 deletions

View File

@@ -129,7 +129,18 @@
<p>If <code>msg.payload</code> is an Object, the node will automatically set the content type
of the request to <code>application/json</code> and encode the body as such.</p>
<p>To encode the request as form data, <code>msg.headers["content-type"]</code> should be set to <code>application/x-www-form-urlencoded</code>.</p>
<p>For form-based file uploads, some services require that <code>msg.headers["content-type"]</code> be set to <code>multipart/form-data</code>.
To construct <code>msg.payload</code> for this type of request, use the following structure and substitue the <code>KEY</code>, <code>DATA</code>, and <code>FILENAME</code>
values for your own.
<pre><code>req.formData = {
KEY: {
value: DATA,
options: {
filename: FILENAME
}
}
}
</code></pre>
</script>
<script type="text/javascript">