简体   繁体   English

使用Android 7和Node.js在multipart / form-data中发送参数

[英]Sending parameters in multipart/form-data using Android 7 and Node.js

I've been searching everywhere for a way to do a post request using Node.js as my back-end and android as my front-end. 我一直在到处寻找一种使用Node.js作为后端并使用android作为前端进行发布请求的方法。 After asking many people we discovered that my body-parser in express Node.js had problems. 问了很多人后,我们发现我在Express Node.js中的身体分析器有问题。 I tried to fix the problem by reinstalling the parser and thus making sure no file was missing, but it still doesn't work. 我试图通过重新安装解析器来解决此问题,从而确保没有文件丢失,但仍然无法正常工作。 Therefore, my Node.js post method only receives multipart/form-data . 因此,我的Node.js post方法仅接收multipart/form-data

I can't seem to find anywhere for a way to send parameters in multipart/form-data using HttpUrlConnection and Asynctask since in the newer versions of android OkHttpClient and HttpPost aren't supported. 我似乎找不到任何地方可以使用HttpUrlConnectionAsynctaskmultipart/form-data发送参数,因为在更高版本的android中,不支持OkHttpClientHttpPost

Can anyone help me out? 谁能帮我吗?

I would recommend using Retrofit for making Api Calls in Android. 我建议使用Retrofit在Android中进行Api呼叫。

It is a simplified Library which gives functionalities like sending Mutipart Form Data, providing headers, convert JSON to class object using inbuilt converters etc. 它是一个简化的库,具有发送Mutipart表单数据,提供标头,使用内置转换器将JSON转换为类对象等功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM