Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bypassing and rejecting requests matched by HTTP handlers #391

Open
diego-aquino opened this issue Sep 2, 2024 · 0 comments
Open
Labels
feature New feature or request

Comments

@diego-aquino
Copy link
Member

diego-aquino commented Sep 2, 2024

Following #387, Zimic will be able to reject requests both in local and remote interceptors.

Proposal

As an additional feature, we could support bypassing and rejecting requests in HTTP handlers. The configuration would be similar to onUnhandledRequest.

const handler = interceptor
  .get('/users')
  .respond({ action: 'bypass' | 'reject' }) // remote interceptor can only reject
const handler = interceptor
  .get('/users')
  .respond((request) => {
    // ...
    return { action: 'bypass' | 'reject' } // remote interceptor can only reject
  })

Related

We already have a method handler.bypass() that clears the response of a handler, essentially skipping it when searching for a matched handler. Re-using the same term may cause confusion. I believe we could rename handler.bypass() to handler.skip()/handler.unskip() or handler.clearResponse().

@diego-aquino diego-aquino converted this from a draft issue Sep 2, 2024
@diego-aquino diego-aquino added the feature New feature or request label Sep 2, 2024
@diego-aquino diego-aquino moved this to Backlog in Zimic Sep 2, 2024
@diego-aquino diego-aquino changed the title Support rejecting requests in HTTP handlers Support bypassing and rejecting requests matched by HTTP handlers Sep 2, 2024
@diego-aquino diego-aquino added this to the v0.14.0 milestone Sep 2, 2024
@diego-aquino diego-aquino moved this from Backlog to To do in Zimic Sep 8, 2024
@diego-aquino diego-aquino moved this from Backlog to To do in Zimic Sep 8, 2024
@diego-aquino diego-aquino modified the milestones: v0.14.0, v0.10.0 Sep 8, 2024
@diego-aquino diego-aquino self-assigned this Sep 8, 2024
@diego-aquino diego-aquino modified the milestones: v0.10.0, v0.11.0, v0.12.0, v0.13.0 Sep 8, 2024
@diego-aquino diego-aquino removed their assignment Sep 11, 2024
@diego-aquino diego-aquino removed this from the v0.13.0 milestone Nov 15, 2024
@diego-aquino diego-aquino moved this from To do to Backlog in Zimic Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant