简体   繁体   中英

Http response erroring out when trying to read response from server

I'm having difficulties on retrieving data from my server. I activated CORS and set up my call properly(already tested it with postman). I'm sending the post request to my server, method is being hit but when returning and trying to read the response on the client side, the SDK fails.

在此处输入图像描述

This is the error I'm getting on the console.

在此处输入图像描述

Am I missing something here? do I have to use another plugin for the htttp calls in web environment?

Error information is incomplete, in which line do you get error?

I assume your uri and some other thing are ok.

change filtereDto to:

Map<String,dynamic> filterDto={
 'date':'2020-02-07....',
 'countryId':'1' // string number
}

And you dont need to:

json.encode(filterDto)

in post call, only filterDto is enough

... body: filterDto ...

I have found the issue. Cors was being enabled on my server side incorrectly. Order activating Cors is critical for configurations to be applied properly in a.Net core app.

This is how is done. First activate Cors and then MVC.

在此处输入图像描述

Hope it helps anyone who is struggling with the same thing.

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