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

When using C# code generation WithBody() matcher is not generated for POST Request #1095

Closed
asos-alexhaigh opened this issue May 1, 2024 · 3 comments
Assignees
Labels

Comments

@asos-alexhaigh
Copy link

Describe the bug

When you generate C# code using MappingConverterType=Builder the created code doesn't contains .WithBody for the request.

Expected behavior:

A clear and concise description of what you expected to happen.

Test to reproduce

  • 1 Record a POST request with a JSON body
  • 2 In __admin\mappings Observer the JSON file generated has a Body Matcher defined
  "Request": {
    "Path": {
      "Matchers": [
        {
          "Name": "WildcardMatcher",
          "Pattern": "/rest/v4/users",
          "IgnoreCase": false
        }
      ]
    },
    "Methods": [
      "POST"
    ],
    "Body": {
      "Matcher": {
        "Name": "JsonMatcher",
        "Pattern": {
          "addressLine1": "123 Main Street",
          "city": "New York",
          "clientUserId": "integration-test-user-1",
          "country": "US",
          "dateOfBirth": "1980-01-01",
          "email": "integrationtestuser1@company.com",
          "firstName": "Alex",
          "lastName": "Test",
          "postalCode": "10016",
          "profileType": "BUSINESS",
          "businessName": "Integration Test 1",
          "programToken": "prg-3f63490c-e249-46e7-97f5-31c725d51f3a",
          "stateProvince": "NY"
        },
        "IgnoreCase": true,
        "Regex": false
      }
    }
  },
  • 3 Make a GET request to http://localhost:9095/__admin/mappings/code?MappingConverterType=Builder
  • 4 Observe C# code doesn't have Body match on Request
        builder
            .Given(Request.Create()
                .UsingMethod("POST")
                .WithPath("/rest/v4/users")
                .WithHeader("Accept", "*/*", true)
                .WithHeader("Connection", "keep-alive", true)
                .WithHeader("User-Agent", "PostmanRuntime/7.37.3", true)
                .WithHeader("Accept-Encoding", "gzip, deflate, br", true)
                .WithHeader("Content-Type", "application/json", true)
                .WithHeader("Content-Length", "443", true)
                .WithHttpVersion("1.1")
            )
            .WithGuid("66cb85f5-6a2c-4f67-b685-3fcb9275e17a");
@StefH StefH self-assigned this May 2, 2024
@StefH
Copy link
Collaborator

StefH commented May 3, 2024

Thanks for the detailed description, I'll take look.

@StefH
Copy link
Collaborator

StefH commented May 8, 2024

#1101

@StefH
Copy link
Collaborator

StefH commented May 8, 2024

Solved

@StefH StefH closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants