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

Turn on/off mock at sniffer level #359

Open
sharkiodev opened this issue Jan 1, 2024 · 0 comments
Open

Turn on/off mock at sniffer level #359

sharkiodev opened this issue Jan 1, 2024 · 0 comments
Assignees
Labels
backend Changes related to traffic-sniffer enhancement New feature or request

Comments

@sharkiodev
Copy link

sharkiodev commented Jan 1, 2024

Please add an additional field to the sniffer object. isMockingEnabled

And add an additional check-in find mock function in mock middleware:
If mocks are disabled don't return the mock

async findMock(hostname: string, url: string, method: string) {
const subdomain = hostname.split(".")[0];
const sniffer = await this.snifferService.findBySubdomain(subdomain);
if (sniffer != null && sniffer.userId != null) {
const urlNoParams = url.split("?")[0];
const mock: Mock | null = await this.mockService.getByUrl(
sniffer?.userId,
sniffer?.id,
urlNoParams,
method,
);
if (mock != null && mock.isActive === true) {
return mock;
}
}
}

Also in the UI add it in the sniffer card a toggle button with disable mock:
Screenshot 2024-01-01 at 13 58 41

@idodav idodav assigned idodav and shravan20 and unassigned idodav Jan 1, 2024
@shravan20 shravan20 added enhancement New feature or request backend Changes related to traffic-sniffer labels Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Changes related to traffic-sniffer enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants