mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
add multipart/form-data support to http request node
This commit is contained in:
@@ -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">
|
||||
|
Reference in New Issue
Block a user