我正在努力将 angularjs 应用程序转换为 React,并决定使用 axios 进行 API 请求。一切工作正常,除了一些 JSON 类型的响应主体,但布尔值是字符串类型而不是布尔值。它与 angularJs $http 一起工作正常,但某些端点返回这样的结果。
这些模块是 AngularJs + Typescript 2.9.1 + axios 0.19.0
let request = Axios({
...requestConfig,
url: resource, method: 'get', responseType: 'json'
}).then(response => response);
Run Code Online (Sandbox Code Playgroud)
响应主体是
{
some: "true"
}
Run Code Online (Sandbox Code Playgroud)
但我例外
{
some: true
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?