【发布时间】:2020-09-20 16:50:10
【问题描述】:
我发现 axios 返回的是字符串而不是有效的 json。
headers:Object {date: "Tue, 02 Jun 2020 08:44:06 GMT", server: "Apache", connection: "close", …}
connection:"close"
content-type:"text/html; charset=UTF-8"
date:"Tue, 02 Jun 2020 08:44:06 GMT"
server:"Apache"
transfer-encoding:"chunked"
如何在 NestJs 应用程序中将 content-type 更改为 application/json? 我试过了,但没有用
const meterInfo = await this.httpService.get(url, { headers: { "Content-Type": "application/json" } }).toPromise();
这是返回的无效 json。
"{"status":"00","message":"OK","access_token":"2347682423567","customer":{"name":"John Doe","address":"Mr. John Doe 34 Tokai, leaflet. 7999.","util":"Demo Utility","minimumAmount":"13897"},"response_hash":"c43c9d74480f340f55156f6r5c56487v8w"}"
【问题讨论】:
标签: node.js json axios nestjs httpservice