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

feat: request match by body (#12) #108

Merged
merged 7 commits into from
Mar 17, 2024

Conversation

diego-aquino
Copy link
Member

@diego-aquino diego-aquino commented Mar 17, 2024

Features

  • [#zimic] Added support to restrict request trackers by body.
const creationTracker = authInterceptor
  .post('/users')
  .with({
    body: creationPayload,
  })
  .respond((request) => {
    const user: User = {
      id: crypto.randomUUID(),
      name: request.body.name,
      email: request.body.email,
    };

    return {
      status: 201,
      body: user,
    };
  });

const response = await createUser(creationPayload);
expect(response.status).toBe(201);

Refactoring

  • [#zimic] Simplified request and response body schemas.
    • Unified HttpInterceptorSchema.RequestBody and HttpInterceptorSchema.ResponseBody into HttpInterceptorSchema.Body, as the previous RequestBody and ResponseBody had the same semantics.
  • [#zimic] Improved HTTP interceptor test scenarios, following real-world cases more closely for each method.
    Closes HTTP interceptor request match by body #12.

@diego-aquino diego-aquino added this to the v0.3.0 milestone Mar 17, 2024
@diego-aquino diego-aquino self-assigned this Mar 17, 2024
@diego-aquino diego-aquino merged commit 9e95b20 into canary Mar 17, 2024
4 checks passed
@diego-aquino diego-aquino deleted the @diego-aquino/12-request-match-by-body branch March 17, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP interceptor request match by body
1 participant