Ionic framework ionic v4中的本机http post

Ionic framework ionic v4中的本机http post,ionic-framework,ionic4,Ionic Framework,Ionic4,在我将我的应用程序部署到“android”设备上后,它无法正常工作,因为我使用了httpclient,而且我在CORS上遇到了问题。 现在我在本地HTTP插件上做post请求时被困了5天,请记住,我使用的是旧代码中相同的头和数据,但它一直告诉我“您必须输入userID并通过”,即使它在post请求中也是如此 {'withCredentials': 'true','accept':'*/*','accept-encoding':'gzip, deflate','content-type

在我将我的应用程序部署到“android”设备上后,它无法正常工作,因为我使用了httpclient,而且我在CORS上遇到了问题。 现在我在本地HTTP插件上做post请求时被困了5天,请记住,我使用的是旧代码中相同的头和数据,但它一直告诉我“您必须输入userID并通过”,即使它在post请求中也是如此

      {'withCredentials': 'true','accept':'*/*','accept-encoding':'gzip, deflate','content-type':'application/x-www-form-urlencoded; charset=UTF-8','user-agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'
  } )
    .then(response => {
      // prints 200
      console.log(response),
      this.raw = response;}, err => {
        console.log('JS call err : ',err);
      });
响应状态为:200,但它是“您必须输入userID并通过”。 我尝试更改用户和传递方法,但没有成功

首先,这是我的帖子的控制台日志:

这是来自PC浏览器的帖子,可以比较:

(

最后,我确实发送了post请求,该请求将返回我的有效负载,以确保这是post:


您能从尝试离子本机http连接后端来解决我的特殊问题吗, 需要做什么:

首先禁用redirct

this.http.disableRedirect(true);
然后使用新的get请求捕获err,将您重定向到所需的页面,因为已经建立了cookie

this.http.get(apiUrl2, {responseType: 'text'}, {});

CORS与服务器相关。您必须在服务器上启用CORS。这与CORS无关,因为我使用的是本机http插件