WithoutHeader fluent assertion #564

Closed
opened 2025-12-29 15:27:05 +01:00 by adam · 6 comments
Owner

Originally created by @jvmlet on GitHub (Dec 25, 2023).

Originally assigned to: @StefH on GitHub.

Please support WithoutHeader in WireMockAssertions
Thanks

Originally created by @jvmlet on GitHub (Dec 25, 2023). Originally assigned to: @StefH on GitHub. Please support `WithoutHeader` in `WireMockAssertions` Thanks
adam added the feature label 2025-12-29 15:27:05 +01:00
adam closed this issue 2025-12-29 15:27:05 +01:00
Author
Owner

@StefH commented on GitHub (Dec 25, 2023):

https://github.com/WireMock-Net/WireMock.Net/pull/1049

@StefH commented on GitHub (Dec 25, 2023): https://github.com/WireMock-Net/WireMock.Net/pull/1049
Author
Owner

@StefH commented on GitHub (Dec 25, 2023):

@jvmlet
Can you check the PR if this is what you need?

@StefH commented on GitHub (Dec 25, 2023): @jvmlet Can you check the PR if this is what you need?
Author
Owner

@StefH commented on GitHub (Dec 26, 2023):

If you want, you can try preview version 1.5.46-ci-18207

@StefH commented on GitHub (Dec 26, 2023): If you want, you can try preview version 1.5.46-ci-18207
Author
Owner

@jvmlet commented on GitHub (Dec 26, 2023):

Can you check the PR if this is what you need?

Thanks @StefH , would you please add WithoutHeader(string name), regardless the value ?

We integrated HeadersPropagation extension from MS and I want to make sure some headers don't leak to downstream services, no matter what the value is.

[CustomAssertion]
    public AndConstraint<WireMockAssertions> WithoutHeader(string expectedKey,  string because = "", params object[] becauseArgs)
        => WithoutHeader(expectedKey, Array.Empty<string>(), because, becauseArgs);
@jvmlet commented on GitHub (Dec 26, 2023): > Can you check the PR if this is what you need? Thanks @StefH , would you please add `WithoutHeader(string name)`, regardless the value ? We integrated `HeadersPropagation` extension from MS and I want to make sure some headers don't leak to downstream services, no matter what the value is. ````c# [CustomAssertion] public AndConstraint<WireMockAssertions> WithoutHeader(string expectedKey, string because = "", params object[] becauseArgs) => WithoutHeader(expectedKey, Array.Empty<string>(), because, becauseArgs); ````
Author
Owner

@StefH commented on GitHub (Dec 26, 2023):

The problem is that I cannot keep that proposed method definition.
That because and becauseArgs will make the other existing WithoutHeader methods invalid.

So I can do:

public AndConstraint<WireMockAssertions> WithoutHeader(string unexpectedKey, (string Text, object[] Args)? because = null)

or / and

public AndConstraint<WireMockAssertions> WithoutHeaderKey(string unexpectedKey, string because = "", params object[] becauseArgs)
@StefH commented on GitHub (Dec 26, 2023): The problem is that I cannot keep that proposed method definition. That because and becauseArgs will make the other existing WithoutHeader methods invalid. So I can do: ``` c# public AndConstraint<WireMockAssertions> WithoutHeader(string unexpectedKey, (string Text, object[] Args)? because = null) ``` or / and ``` c# public AndConstraint<WireMockAssertions> WithoutHeaderKey(string unexpectedKey, string because = "", params object[] becauseArgs) ```
Author
Owner

@jvmlet commented on GitHub (Dec 26, 2023):

WithoutHeaderKey looks great, thanks a lot.

@jvmlet commented on GitHub (Dec 26, 2023): `WithoutHeaderKey` looks great, thanks a lot.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#564