- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是一个nest.js 初学者,我正在尝试用我的代码实现Axios,并且发生了这个错误,我想修复它。
--> starting at object with constructor 'ClientRequest'
| property 'socket' -> object with constructor 'Socket'
--- property '_httpMessage' closes the circle +188941ms
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'ClientRequest'
| property 'socket' -> object with constructor 'Socket'
--- property '_httpMessage' closes the circle
at JSON.stringify (<anonymous>)
at stringify (D:\CUSportcomplex-register\sso-reg\node_modules\express\lib\response.js:1123:12)
at ServerResponse.json (D:\CUSportcomplex-register\sso-reg\node_modules\express\lib\response.js:260:14)
at ExpressAdapter.reply (D:\CUSportcomplex-register\sso-reg\node_modules\@nestjs\platform-express\adapters\express-adapter.js:24:57)
at RouterResponseController.apply (D:\CUSportcomplex-register\sso-reg\node_modules\@nestjs\core\router\router-response-controller.js:13:36)
at D:\CUSportcomplex-register\sso-reg\node_modules\@nestjs\core\router\router-execution-context.js:173:48
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async D:\CUSportcomplex-register\sso-reg\node_modules\@nestjs\core\router\router-execution-context.js:47:13
at async D:\CUSportcomplex-register\sso-reg\node_modules\@nestjs\core\router\router-proxy.js:9:17
这是我的 app.service.ts
async validateSSO(appticket): Promise<SsoContent> {
let instance = axios.create({
baseURL: "http://localhost:8080/",
headers: {
'DeeAppId': config.DeeAppId,
'DeeAppSecret': config.DeeAppSecret,
'DeeTicket': appticket
}
});
instance.get("/serviceValidation")
.then(response => {
this.ssoContent = response;
})
.catch(error => {
return (error);
});
return this.ssoContent;
}
这是我的 app.controller.ts
@Get('validation/:appticket')
async validateSSO(
@Param('appticket') appticket: string
//DeeAppTicket is sented via Front-end
): Promise<SsoContent> {
return this.registeringService.validateSSO(appticket);
}
感谢您的帮助 :)
最佳答案
首先,nest.js 为您提供了开箱即用的 HttpService,您可以通过 DI 注入(inject)它:
https://docs.nestjs.com/techniques/http-module
其次 - 您正在尝试存储整个响应对象,它是复杂的数据结构并包含错误消息中所述的循环依赖项(TypeError:将循环结构转换为 JSON)
您应该做的是映射您需要的数据而不是存储整个圆形对象,
或者您应该查看一些可以解析循环 json 的库:https://www.npmjs.com/package/flatted
关于typescript - 类型错误 : Converting circular structure to JSON --> starting at object with constructor 'ClientRequest' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64735881/
环形缓冲区和循环链表有什么区别? Ring Buffer 的目的是什么,而循环链表不能,反之亦然? 最佳答案 环形缓冲区是一个连续的内存块,其中包含您的项目,当您到达终点时,您会循环回到起点: +--
我有一个像这样的多级依赖关系图,我需要检测该图中的任何循环引用。 A = B 乙=丙 C = [D, B] D = [C, A] 有人有这样的问题吗? 有什么解决办法??? 用英语表示感谢和抱歉。 =
尝试编写一个reduce函数来过滤掉任何重复项。我知道还有其他方法可以解决这个问题,但我正在尝试练习递归函数。 function addToSet(a, b) { a.add(b); retu
我想知道是否有人已经实现/知道(最好是 javascript)将处理循环间隔的间隔树算法。通过循环,我的意思是开始 > 结束的间隔。请注意,这也需要限制间隔的大小。 这只是常见区间树问题的一个子案例吗
我有一段代码,其中声明了两种数据类型。我已经将两者都自动派生为类型类 enum 的成员,但是,我不喜欢它们不是“圆形”的。我的意思是调用 succ Sun应该让我Mon . succ Dec应该导致
运行此代码时: function arrayToList(arr) { if (arr.length == 1) { return { value: arr[0],
我有以下模块结构: /components ├── Button.js ├── Checkbox.js ├── index.js ├── DateSelect ├── DateSelect.j
为了检查光线与三角形的碰撞,我们可以首先查看光线是否与三角形的平面发生碰撞。如果是,我们然后检查所有三角形边的交点是否在同一边。如果为真,则意味着该点位于三角形内部。此过程与矩形和其他凸图形类似。 这
我遇到了同样的问题,如下所示: NHibernate - not-null property reference a null or transient value 根本原因就像 Alun Harfo
我想以“循环”方式使用函数,如下例所示: fun cll1 (s)= cll2(s); fun cll2 (s)= cll3(s); fun cll3 (s)= cll(s); 编写此代码会在 SML
我想根据现有列的滞后值在 pyspark.sql.DataFrame 中创建一个新列。但是......我也希望最后一个值成为第一个值,第一个值成为最后一个值。这是一个例子: df = spark.cr
我正在使用 Microsoft.ServiceModel.Samples.CircularTracecListener 二进制文件来实现 Web 服务上的错误日志记录。 它应该写入一个文件,直到达到
我有一个由 8 个罗盘点组成的数组,从 SW 顺时针编号到 S: 2 3 4 1 5 0 7 6 我想计算从一点到另一点的最短路线是顺时针 (+1) 还是逆时针 (-1)。例如。从 7 到 5 是
我知道如何解决基本的循环依赖示例,有两个类,每个类都需要知道另一个存在。 但是,我现在的情况是,示例更复杂,前向声明不是可以解决该问题的东西。 考虑这三个文件 // my_thread.hpp tem
我正在开发一款用于在线播放歌曲的应用程序。我可以通过点击播放这首歌。 我的问题是我在所有 Activity 中都有一个 CircularSeekBar,我需要在所有屏幕上管理它。如果从任何 Activ
我正在尝试实现动画 shown here .它工作正常,除了 unreveal 动画,显示黑屏片刻。并非所有设备/api 版本都存在该故障。 Google Nexus 10 (API 22) 的 Ge
我正在使用 Canvas 创建倒数计时器循环,但有一个简单的问题,我需要将天数除以 364 天,当天数大于 364 天时,天数消失: 我需要的是这样的: (function($) { jQuery
我想在不使用 SVG 的情况下实现这样的效果: https://codepen.io/arforcee/pen/erbKi?limit=all&page=2&q=circular+loader 这是否
这个问题在这里已经有了答案: How to create a circle with links on border side (8 个答案) 关闭 4 年前。
我遇到了一个小设计问题。 如下情况 库界面 包含每个模型类的接口(interface)(仅限 getter 和 setter) 图书馆业务逻辑 包含接口(interface)库和 DAL 的实现。使用
我是一名优秀的程序员,十分优秀!