Метод Flutter Http post

Пожалуйста, помогите мне! код состояния = 405. Метод запрещен. / Когда делаю через почтальона, все работает. Вот

class HttpHelper{
  String url;
  HttpHelper(this.url);
  Map<String,String> headers = {
    'Content-type': 'text/html; charset=utf-8',
    'Accept': '*/*',
    'Accept-Encoding': 'gzip, deflate, br',
    'Connection': 'keep-alive',
    'Server': 'Microsoft-IIS/10.0',
    'X-Powered-By': 'ASP.NET',
    "Authorization": basicAuthenticationHeader("Mobile", "1234"),
   };

  static String basicAuthenticationHeader(String username, String password) {
    return 'Basic ' + base64Encode(utf8.encode('$username:$password'));
  }

  Future checkUserFromServer(ConnectionRegistration registration){
    return http.post("http://10.0.2.2/wts/hs/serv/echo",headers: headers,body: json.encode(registration.toJson())).then((data) {
        print(data);
    });
}

}

0 ответов

Другие вопросы по тегам