Multiple headers with same name #48

Closed
opened 2025-12-29 14:21:41 +01:00 by adam · 4 comments
Owner

Originally created by @Dreamescaper on GitHub (Oct 27, 2017).

Originally assigned to: @StefH on GitHub.

Do I understand correct that currently it's not possible to set multiple headers with same name to ResponseMessage?
In particular, I'm interested in providing multiple Set-Cookie headers.
Is it possible to add such functionality? I could submit PR with changing Headers property from 'IDictionary<string, string>' to something like 'IDictionary<string, string[]>', but not sure how great is that, considering that it is public member.

Originally created by @Dreamescaper on GitHub (Oct 27, 2017). Originally assigned to: @StefH on GitHub. Do I understand correct that currently it's not possible to set multiple headers with same name to ResponseMessage? In particular, I'm interested in providing multiple Set-Cookie headers. Is it possible to add such functionality? I could submit PR with changing Headers property from 'IDictionary<string, string>' to something like 'IDictionary<string, string[]>', but not sure how great is that, considering that it is public member.
adam added the feature label 2025-12-29 14:21:41 +01:00
adam closed this issue 2025-12-29 14:21:41 +01:00
Author
Owner

@StefH commented on GitHub (Oct 27, 2017):

First change will be:

IResponseBuilder WithHeader([NotNull] string name, params string[] values);

Also your idea is possible:

IResponseBuilder WithHeaders([NotNull] IDictionary<string,string[]> headers);

However, also the json parsing should be updated. I will take a look.

@StefH commented on GitHub (Oct 27, 2017): First change will be: ```c# IResponseBuilder WithHeader([NotNull] string name, params string[] values); ``` Also your idea is possible: ```c# IResponseBuilder WithHeaders([NotNull] IDictionary<string,string[]> headers); ``` However, also the json parsing should be updated. I will take a look.
Author
Owner

@Dreamescaper commented on GitHub (Oct 27, 2017):

Added PR with simple implementation for that.

@Dreamescaper commented on GitHub (Oct 27, 2017): Added PR with simple implementation for that.
Author
Owner

@StefH commented on GitHub (Oct 27, 2017):

Thanks.

I added the JSON part to your code. Please review.

And if it's ok, I can create a NuGet.

@StefH commented on GitHub (Oct 27, 2017): Thanks. I added the JSON part to your code. Please review. And if it's ok, I can create a NuGet.
Author
Owner

@Dreamescaper commented on GitHub (Oct 28, 2017):

Great, thanks!

@Dreamescaper commented on GitHub (Oct 28, 2017): Great, thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#48