Skip to content

[BUG]: MockResponsePlugin. Get method doesn't work #1417

@kgalyna

Description

@kgalyna

Description

GET methods don’t work for MockResponsePlugin— the error “fail │ An error occurred in a plugin” appears. This issue occurs only in versions 1.2.0 and 1.3.0-beta.
When the same request is changed to POST and run via Fiddler, the mock response is returned successfully.
Version 1.1.0 works correctly.

Expected behaviour

req ╭ GET https://graph.microsoft.com/v1.0/users?$filter=mail%20eq%20%27TestUser0100%40da.com%27&$top=1
time │ 10/7/2025 10:12:53 PM +00:00
trce │ MockResponsePlugin: BeforeRequestAsync called
mock │ MockResponsePlugin: 200 https://graph.microsoft.com/v1.0/users*
trce │ RetryAfterPlugin: BeforeRequestAsync called
skip ╰ RetryAfterPlugin: Response already set

Actual behaviour

req ╭ GET https://graph.microsoft.com/v1.0/users?$filter=mail%20eq%20%27TestUser0100%40da.com%27&$top=1
time │ 10/7/2025 7:14:10 PM +00:00
trce │ MockResponsePlugin: BeforeRequestAsync called
trce │ MockResponsePlugin: ReplacePlaceholders called
fail │ An error occurred in a plugin
trce │ RetryAfterPlugin: BeforeRequestAsync called
skip │ RetryAfterPlugin: Request not throttled
trce │ RetryAfterPlugin: Left BeforeRequestAsync
pass ╰ Passed through

Steps to reproduce

  1. Install version 1.2.0. or 1.3.0-beta
  2. Update the configuration files as described in the “Configuration file” section.
  3. Run Dev Proxy with the following command:: '.\devproxy.exe -c devproxyrc.json --log-level trace'
  4. Open Fiddler and send a GET request to
    https://graph.microsoft.com/v1.0/users?$filter=mail%20eq%20%27TestUser0100%40da.com%27&$top=1
    A.R. (Actual Result): See the Actual Behaviour section above.
    E.R. (Expected Result): See the Expected Behaviour section above.
  5. Open the mock.json file and change "method": "GET" to "method": "POST"
  6. Send the same request again using POST https://graph.microsoft.com/v1.0/users?$filter=mail%20eq%20%27TestUser0100%40da.com%27&$top=1
    A.R.
    req ╭ POST https://graph.microsoft.com/v1.0/users?$filter=mail%20eq%20%27TestUser0100%40da.com%27&$top=1
    time │ 10/7/2025 10:12:53 PM +00:00
    trce │ MockResponsePlugin: BeforeRequestAsync called
    mock │ MockResponsePlugin: 200 https://graph.microsoft.com/v1.0/users*
    trce │ RetryAfterPlugin: BeforeRequestAsync called
    skip ╰ RetryAfterPlugin: Response already set

Dev Proxy Version

1.2.0, 1.3.0-beta

Operating system (environment)

Windows

Shell

PowerShell

Configuration file

devproxyrc.json
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.2.0/rc.schema.json",
"plugins": [
{
"name": "MockResponsePlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll",
"configSection": "mocksPlugin"
},
{
"name": "RetryAfterPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/DevProxy.Plugins.dll"
}
],
"urlsToWatch": [
"https://graph.microsoft.com/",
"https://login.microsoftonline.com/tenantId-test
"
],
"mocksPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.2.0/mockresponseplugin.schema.json",
"mocksFile": "mocks.json"
},
"logLevel": "trace",
"newVersionNotification": "stable",
"showSkipMessages": true,
"showTimestamps": true,
"validateSchemas": true
}

mocks.json
{
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v1.2.0/mockresponseplugin.mocksfile.schema.json",
"mocks": [
{
"request": {
"method": "GET",
"url": "https://graph.microsoft.com/v1.0/users*"
},
"response": {
"statusCode": 200,
"body": "@mocks/users.json"
}
}
]
}
users.json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": [
{
"businessPhones": [],
"displayName": "Test User",
"givenName": null,
"jobTitle": null,
"mail": "testuser@test.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "testuser@TEST.onmicrosoft.com",
"id": "tenantid-test-1111-1111-f42ed6b00000"
}
]
}

Additional Info

When the same request is changed to POST and run via Fiddler, the mock response is returned successfully.
Direct GET requests also don't work.
Version 1.1.0 works correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions