When ios uses axios request, the request header is emptied. How to solve it?

  1. there is no problem with the same interface andriod and pc, but the ios request throws an error network error with an error code of 0 and the request header is cleared. You need to transfer data from application/json, so you don"t use qs because the back end needs to accept objects.

Code

      var instance = axios.create({
            headers: {"Content-Type": "application/json"},
        });
        return new Promise((resolve, reject) => {
            instance({
                method: "post",
                url: "https://openapi.eos.ren/v1/chain/get_account",
                data: {
                  account_name: name
                },
              }).then((res) => {
                resolve(res.data)
              }).catch(res => {
                  console.log(res)
              })
        })
Jul.07,2022

generally use qs with axios, otherwise the parameter may be empty


have you solved it

Menu