# Removing Interceptors from \*\*one\*\* request

**URL:** <https://discourse.aurelia.io/t/removing-interceptors-from-one-request/3172>\
**Category:** Help Requests\
**Created:** [January 21, 2020, 1:18pm UTC](https://discourse.aurelia.io/t/removing-interceptors-from-one-request/3172 "2020-01-21T13:18:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![null](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@null](https://discourse.aurelia.io/u/null)\
**Post date:** [January 21, 2020, 1:18pm UTC](https://discourse.aurelia.io/t/removing-interceptors-from-one-request/3172/1 "2020-01-21T13:18:39Z")

</div>

Hi. I’m fairly new to all of this and recently i bumped into a problem.

I’m using the aurelia-http-client to make calls to a service and using a interceptor to show a toaster(iziToast) if it receives a “201 created” response.

The problem is: there’s one request that will return a 201, that i dont want to show the toaster.

i could create another httpClient, just for that request, but would be way easier if i could just strip the interceptor away when i createRequest().

is there a way of removing the interceptor from a specific request? kinda like .WithInterceptor(), but like something like .WithoutInterceptors()

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [January 21, 2020, 1:54pm UTC](https://discourse.aurelia.io/t/removing-interceptors-from-one-request/3172/2 "2020-01-21T13:54:51Z")

</div>

An interceptor works along this way:

```javascript
.withInterceptor({
        request(request) {
          console.log(`Requesting ${request.method} ${request.url}`);
          return request;
        },
        response(response) {
          console.log(`Received ${response.status} ${response.url}`);
          return response;
        }
      });

```

so as you see you have access to the request/response that happens. Now either one should help you determine which one is the request you want to ditch. In that case just add a conditional if block in order to skip your request.

---

<div class="post-metadata">

**Author:** ![null](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@null](https://discourse.aurelia.io/u/null)\
**Post date:** [January 21, 2020, 2:12pm UTC](https://discourse.aurelia.io/t/removing-interceptors-from-one-request/3172/3 "2020-01-21T14:12:59Z")

</div>

Will this method override the httpClient configuration? because my toaster interceptor is there

---

<div class="post-metadata">

**Author:** ![khuongduybui](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/khuongduybui/32/44_2.png) [@khuongduybui](https://discourse.aurelia.io/u/khuongduybui)\
**Post date:** [January 21, 2020, 2:17pm UTC](https://discourse.aurelia.io/t/removing-interceptors-from-one-request/3172/4 "2020-01-21T14:17:10Z")

</div>

I think what you need to do is to use this method to put your own interceptor on the httpClient.  
Then inside your interceptor, decide whether to call toaster interceptor or not depending on the request / response you receive.
