We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import axios from 'axios' async function my(config) { console.log(config) } const axios = axios.create({validateStatus:false, adapter:my}) console.log(await axios.postForm('https://httpbin.org/post', {1:2,buf:new Buffer.from('aaa')}).then(_ => _.data))
the output is:
FormData { _overheadLength: 200, _valueLength: 2, _valuesToMeasure: [], writable: false, readable: true, dataSize: 0, maxDataSize: 2097152, pauseStreams: true, _released: false, _streams: [ '----------------------------441912445856199199041598\r\n' + 'Content-Disposition: form-data; name="1"\r\n' + '\r\n', '2', [Function: bound ], '----------------------------441912445856199199041598\r\n' + 'Content-Disposition: form-data; name="buf"\r\n' + 'Content-Type: application/octet-stream\r\n' + '\r\n', <Buffer 61 61 61>, [Function: bound ] ], _currentStream: null, _insideLoop: false, _pendingNext: false, _boundary: '--------------------------441912445856199199041598' }
and
headers: Object [AxiosHeaders] { Accept: 'application/json, text/plain, */*', 'Content-Type': 'multipart/form-data' },
I want to know how to construct the correct request body
----------------------------441912445856199199041598 Content-Disposition: form-data; name="1" 2 ----------------------------441912445856199199041598 Content-Disposition: form-data; name="buf" Content-Type: application/octet-stream aaa ----------------------------441912445856199199041598--
and the correct content-type
'Content-Type': 'multipart/form-data; boundary=----------------------------441912445856199199041598'
I see there similar code in https://github.com/axios/axios/blob/main/lib/adapters/http.js. But I have no idea how to reuse the source code in https://github.com/axios/axios/blob/main/lib/adapters/http.js.
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the issue
the output is:
and
I want to know how to construct the correct request body
and the correct content-type
I see there similar code in https://github.com/axios/axios/blob/main/lib/adapters/http.js. But I have no idea how to reuse the source code in https://github.com/axios/axios/blob/main/lib/adapters/http.js.
Example Code
No response
Expected behavior
No response
Axios Version
No response
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
No response
OS
No response
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: