腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(9999+)
视频
沙龙
2
回答
Angular
-
如何
模拟
HttpErrorResponse
?
html
、
angular
、
error-handling
、
httpresponse
、
angular-httpclient
我正在尝试测试我的代码,我的应用程序将
如何
处理特定的
HttpErrorResponse
(特别是302重定向)。有没有办法在我的应用程序上
模拟
一个请求,让它抛出一种类型的
HttpErrorResponse
?我说的不是单元测试,而是我的应用程序的实际运行时执行。
浏览 19
提问于2020-10-14
得票数 0
2
回答
http错误拦截器不工作CatchError不使用角13
angular
、
typescript
、
rxjs
HttpEvent<any>> { .pipe( catchError((error:
HttpErrorResponse
浏览 25
提问于2022-01-08
得票数 1
2
回答
类型'Observable<any>‘不能赋值给类型'void’我该怎么解决这个问题?
angular
、
observable
、
behaviorsubject
我不清楚该
如何
修复它。导致错误的代码行是return this.sleepReponse.next(score),应该
如何
将其传递给我的BehaviorSubject?: number): Observable<any |
HttpErrorResponse
> { if (forceResponse === undefined) {
浏览 28
提问于2021-08-18
得票数 1
1
回答
角度错误TS2554:应为0个参数,但在管道运算符上获得x
angular
、
typescript
arguments, but got 4 getHappyDays() Observable返回一个Observable<HttpResponse<IHappyDays>> | Observable<
HttpErrorResponse
mergeMap((res) => { }) } https://stackblitz.com/edit/
angular
浏览 19
提问于2019-02-12
得票数 5
回答已采纳
1
回答
Jasmine:单元测试可观察到的http服务错误
angular
、
unit-testing
、
jasmine
、
karma-jasmine
我对
如何
模拟
我的http服务捕捉到一个可观察到的错误感到非常困惑。我已经通读了
angular
文档,但我不明白我将
如何
构建测试。我想
模拟
我的服务中的一个错误,然后检查它是否捕获了一个可观察到的错误。老实说,我对
如何
实现这一点感到非常困惑。console.error(error.message || error);} 现在我该
如何
模拟
一个错误呢imp
浏览 3
提问于2018-07-03
得票数 7
回答已采纳
1
回答
Angular
HttpErrorResponse
angular
我正在尝试通过在请求URL上发送用户名来获取用户购物车,但我收到一个错误。 list: PanieDto[] = [];isLoggedIn = false;showModeratorBoard = false;PanieDocument?: string[] = []; constructor(private router: Router, pri
浏览 8
提问于2021-04-26
得票数 1
回答已采纳
1
回答
角度截取http错误
angular
、
typescript
、
error-handling
、
interceptor
但是,我找不到拦截
HttpErrorResponse
的方法。 我尝试了两种方法。} }, if (error instanceof
HttpErrorResponse
我见过人们(https://medium.com/@aleixsuau/error-handling-
angular
-859d529fa53a)在模块中注册ErrorHandler,但我还没有
浏览 12
提问于2019-03-13
得票数 1
回答已采纳
2
回答
我必须在Ionic 4中集成自定义错误处理
angular
、
cordova
、
ionic-framework
、
ionic4
我已经创建了一个名为"ErrorHandlingService“的服务,下面给出了代码 export class
浏览 6
提问于2019-07-17
得票数 1
1
回答
带自定义头的
Angular
- Unit-test
HttpErrorResponse
(HttpClientTestingModule)
angular
、
typescript
、
unit-testing
、
karma-jasmine
、
angular-httpclient
Observable<any> { .pipe( let error = new Error('',
httpErrorResponse
.status);if (
httpErrorResponse
.header
浏览 15
提问于2020-02-25
得票数 1
1
回答
试着得到测试单元的案例。我想不出怎么去模仿HttpClientRequests,我有点卡住了
angular
、
http
、
testing
、
jasmine
、
case
在试图弄清楚
如何
为一个项目
模拟
一个HttpRequest时,我决定我应该为一个简单的项目做它,这个项目是我从零开始创建的。import { HttpClient,
HttpErrorResponse
, HttpResponse } from '@
angular
/common
浏览 3
提问于2022-03-08
得票数 0
1
回答
如何
在
angular
8中获取http错误响应文本?
angular
、
http
this.authservice.login.subscribe(res => { }, err => { })); 有谁可以帮我?在err part中,我没有从后端获得响应文本,每次都只显示"Bad Request“。
浏览 14
提问于2020-01-03
得票数 0
回答已采纳
1
回答
错误TypeError:无法读取未定义的属性“openDialogTEST”
angular
、
typescript
、
rxjs
、
angular-material
catchError(this.myerrorhandle.handleError) } handleError(errorResponse:
HttpErrorResponse
浏览 0
提问于2018-08-30
得票数 1
回答已采纳
2
回答
在角4中全局捕获请求,如果没有internet,则停止
angular
、
internet-connection
、
angular-http-interceptors
但是
如何
取消HttpInterceptor中的请求呢?或者有更好的方法来处理这件事?import { Injectable } from '@
angular
/core'; HttpRequest, HttpEvent,HttpInterceptorimport { Observable } from 'rxjs/Obser
浏览 4
提问于2017-10-18
得票数 7
回答已采纳
1
回答
离子ios
模拟
器无法发出http请求
ios
、
ionic-framework
、
ionic4
在ios
模拟
器上对离子5发出post请求的问题 "statusText": "Unknown Error", "ok": false, "name": "
HttpErrorRespons
浏览 3
提问于2020-07-16
得票数 0
回答已采纳
1
回答
如何
在
Angular
中获取ExceptionMessage
angular
使用此代码,我
如何
error.ExceptionMessage?当我在下面的控制台中看到它时,它是暴露的,但我得到:private handleError(error:
HttpErrorResponse
) { // Client-side
浏览 5
提问于2019-11-19
得票数 0
回答已采纳
1
回答
角6错误处理程序服务中的“无法找到http”
angular
、
typescript
、
angular-http-interceptors
,
HttpErrorResponse
} from '@
angular
/common/http'; public http: InterceptService super(); if (error instanceof
HttpErrorRes
浏览 0
提问于2018-08-28
得票数 0
回答已采纳
4
回答
如何
在
Angular
5中重定向到401响应的登录页面?
angular
、
typescript
、
oauth-2.0
、
interceptor
我正在开发一个使用OAuth2隐式流的
Angular
5应用程序。遵循我的auth拦截器: import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@
angular
/common/http';import { Observable } from "rxjs"; @Injectab
浏览 85
提问于2018-06-25
得票数 17
回答已采纳
1
回答
Angular
5拦截器在服务器调用失败时未注销
angular
、
typescript
、
typescript2.0
this.addToken(request)) catchError((error, ca) => { switch ((<
HttpErrorResponse
>error).status) { case 401:这个实现出了什么问题,
如何
在401错误响应后使控件处于错误块中。在这里使用
angula
浏览 6
提问于2017-12-20
得票数 0
1
回答
如何
对角度拦截器进行单元测试
angular
、
unit-testing
、
angular-http-interceptors
我一直在寻找测试
Angular
Interceptor代码以进行错误处理的方法,但我似乎找不到方法。pipe( if(err instanceof
HttpErrorResponse
浏览 4
提问于2020-01-24
得票数 1
1
回答
HttpErrorResponse
angular
7
angular
、
spring-boot
我正在开发一个
angular
7应用程序,但是我遇到了一个get请求的问题。下面是错误:
HttpErrorResponse
{headers: HttpHeaders, status: 302, statusText: "OK", url: "http://localhostnull, lazyInit: ƒ} message: "Http failure response for http://localhost:9090/things/: 302 O
浏览 22
提问于2019-02-16
得票数 2
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
如何用 Angular 实现深色模式
微前端如何改变 Angular 的未来?
我是如何为 Angular Components 做出贡献的
Angular、React 和 Vue 三大框架,Web 开发该如何选择?
如何用Postman模拟接口测试
热门
标签
更多标签
云服务器
ICP备案
实时音视频
即时通信 IM
对象存储
活动推荐
运营活动
广告
关闭
领券