[英]nativescript post request using body form-data
I want to send a user JSON object to a login post url like in the screenshot from postman . 我想将用户JSON对象发送到登录帖子网址,如postman的屏幕截图中所示。 to have a successful login it must be exactly as in the screenshot, otherwise I receive user object not found in the response from the api .
要成功登录,必须与屏幕截图中的完全相同,否则我会收到api响应中未找到的用户对象。 So I did not succeed to send a valid user object as the requirement .
因此,我没有成功发送有效的用户对象作为要求。
I get successful login only with postman . 我只有邮递员才能成功登录。 I need a solution for nativescript (typescript)
我需要本机脚本(打字稿)的解决方案
multipart/form-data
is not yet supported by Http module. Http模块尚不支持
multipart/form-data
。 There is an open feature request that you might want to follow up for updates. 您可能需要跟进一个开放功能请求以进行更新。
Also using form data for passing simple values is not very much encouraged, if you have access to the APIs then I would suggest you to modify them to use JSON. 也不太鼓励使用表单数据来传递简单值,如果可以访问API,那么我建议您修改它们以使用JSON。
I believe nativescript-background-http
plugin should work with this scenario, but haven't tried it myself. 我相信
nativescript-background-http
插件应该可以在这种情况下使用,但是我自己还没有尝试过。 There is also a simple plugin from community that you might want to try. 还有一个来自社区的简单插件 ,您可能想尝试一下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.