Skip to content

[BUG]: An item with the same key has already been added. Key: Set-Cookie #1169

Closed
@ThaDaVos

Description

@ThaDaVos

Description

When making API calls to the service of Viva Payments, I keep getting errors like below:

 fail    An error occurred in a plugin Exception Details: System.Exception: Exception thrown in user event
 ---> System.ArgumentException: An item with the same key has already been added. Key: Set-Cookie
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at DevProxy.Plugins.Inspection.DevToolsPlugin.AfterResponseAsync(Object sender, ProxyResponseArgs e)
   at DevProxy.Abstractions.FuncExtensions.InternalInvokeAsync[T](AsyncEventHandler`1 callback, Object sender, T args, ExceptionHandler exceptionFunc)
   --- End of inner exception stack trace ---

I guess due to this, my DevInspector Responses are also empty - so I can't really work with it now...
The requests are made using Microsoft Kiota

I saw the bug was also in the MockGeneratorPlugin: #358

Expected behaviour

No error? Or at least the Responses to be populated in the DevInspector

Actual behaviour

Error and empty responses in the DevInspector

Steps to reproduce

I guess it's Viva Payments specific - but probably all endpoints which violate the RFC 6265
https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1

Dev Proxy Version

0.27.0

Operating system (environment)

Windows

Shell

PowerShell

Configuration file

{
    "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.27.0/rc.schema.json",
    "plugins": [
        {
            "name": "DevToolsPlugin",
            "enabled": true,
            "pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
            "configSection": "devTools"
        }
    ],
    "devTools": {
        "$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v0.27.0/devtoolsplugin.schema.json",
        "preferredBrowser": "Edge"
    },
    "urlsToWatch": [
        "https://demo-api.vivapayments.com/*",
        "https://api.vivapayments.com/*",
        "https://demo-accounts.vivapayments.com/connect/token",
        "https://accounts.vivapayments.com/connect/token"
    ],
    "logLevel": "debug",
    "newVersionNotification": "stable",
    "showSkipMessages": true,
    "showTimestamps": true
}

Additional Info

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions