Support multipart form data
See original GitHub issueSorry! I am learning English. So…
I mean this
That’s the request header:
That’s the request body:
The type is multipart/form-data
This my router:
export default router => {
router.get('/getList', async ctx => {
ctx.response.body = 'get getList';
});
router.post('/getList', async ctx => {
const result = await ctx.request.body({
contentTypes: {
json: ['application/json'],
form: ['multipart/form-data'],
text: ['application/json']
}
});
if(result.type === 'form'){
console.log(result.value.get('name'));
}
ctx.response.body = result.value;
});
}
But what I got is null, I consoled this value with for…of, the output is
[
"----------------------------387832257824253405999369
Content-Disposition: form-data; name",
""group_id"
1659592055145472
----------------------------387832257824253405999369
Content-Dispos..."
]
I know this is the boundary, but how to deal whit this file type? Thank you very much! : )
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:17 (1 by maintainers)
Top Results From Across the Web
What does enctype='multipart/form-data' mean? - Stack Overflow
When you make a POST request, you have to encode the data that forms the body of the request in some way. HTML...
Read more >Multipart/form-data - OutSystems
OutSystems does not support multipart/form-data. However, the Multipart/form-data plugin allows to achieve it. Read this nicely documented ...
Read more >Multipart (Form Data) Format - MuleSoft Documentation
DataWeave supports Multipart subtypes, in particular form-data . These formats enable you to handle several different data parts in a single payload, ...
Read more >Multipart Requests - Swagger
Multipart requests combine one or more sets of data into a single body, separated by ... File uploads typically use the multipart/form-data media...
Read more >What is multipart form data? How to handle it with ... - YouTube
Today we discuss what is multipart form data, when it is used, and the types of API calls it will be needed form....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve started working on this, but it is fairly complex. I am not convinced the
std
multi part really is a good interface, so I am going to come up with something a better better I think.@lengfangbing Yes, dealing with multi-part form data is something oak should do without the user being aware of how it is dealt with.