简体   繁体   中英

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 . 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 . 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)

postman screenshot

multipart/form-data is not yet supported by Http module. 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.

I believe nativescript-background-http plugin should work with this scenario, but haven't tried it myself. There is also a simple plugin from community that you might want to try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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