ng-stack icon indicating copy to clipboard operation
ng-stack copied to clipboard

[api-mock] Dont make changes if put/post/etc returns a HttpErrorResponse

Open yusijs opened this issue 4 years ago • 4 comments

I'm currently using api-mock for a project, and I've found a lot of stuff I absolutely love about it. However, I recently implemented a PUT operation where I want it to throw errors in certain scenarioes. I implemented a handler for it, and I am able to return an error.

Despite returning an error, the items in my collections gets updated. Any chance this behaviour can be changed, or we can somehow control the updates ourselves with a config flag?

Thanks!

yusijs avatar Jun 23 '21 11:06 yusijs

Do you use responseCallback in this case?

KostyaTretyak avatar Jun 24 '21 06:06 KostyaTretyak

I do, yes.

yusijs avatar Jun 24 '21 13:06 yusijs

That is, your Angular component gets an error, but @ng-stack/api-mock still updates the mock data?

KostyaTretyak avatar Jun 24 '21 13:06 KostyaTretyak

Yes - the 400 errors gets returned as expected, but the item still gets changed.

yusijs avatar Jun 26 '21 12:06 yusijs

Sorry, but @ng-stack/api-mock no more supports.

KostyaTretyak avatar Feb 17 '23 10:02 KostyaTretyak