-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add convenient method for matching absence of form param in a request #2193
Add convenient method for matching absence of form param in a request #2193
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…-of-form-param-in-a-request
Fixed merged conflicts, I hope |
import com.github.tomakehurst.wiremock.WireMockServer; | ||
import com.github.tomakehurst.wiremock.common.FatalStartupException; | ||
import com.github.tomakehurst.wiremock.common.FileSource; | ||
import com.github.tomakehurst.wiremock.http.ResponseDefinition; | ||
import com.github.tomakehurst.wiremock.matching.RequestPattern; | ||
import com.github.tomakehurst.wiremock.stubbing.StubMapping; | ||
import java.io.PrintStream; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only formatting changes because of spotless
System.setErr( | ||
new PrintStream(err) { | ||
@Override | ||
public void println(String s) { | ||
if (!s.startsWith("SLF4J")) { | ||
super.println(s); | ||
} | ||
} | ||
|
||
@Override | ||
public void println(char[] chars) { | ||
if (!new String(chars).startsWith("SLF4J")) { | ||
super.println(chars); | ||
} | ||
} | ||
|
||
@Override | ||
public void println(Object o) { | ||
if (!o.toString().startsWith("SLF4J")) { | ||
super.println(o); | ||
} | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only formatting changes because of spotless
Finally figured that we can't use multipart/form-data. So switched test to application/form-url-encoded. |
@JsonProperty | ||
@Override | ||
public String key() { | ||
return super.key(); | ||
} | ||
|
||
@JsonProperty | ||
@Override | ||
public List<String> values() { | ||
return super.values(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should exposing those APIs to JSON be considered another new feature in the changelog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I am not sure what you meant by release logs. Is it the PR title?
I have added a point in the PR description why this change is necessary.
The absence of this is actually a bug. The near-miss response deserialization is not possible without the annotation. I can try to reproduce the same and put out another PR just fixing this aspect before we merge this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oleg-nenashev
I checked it a bit more. Looks like those JSON changes are no longer needed for the tests to pass.
Something must have changed after I had raised the PR. In any case I removed these changes.
This pull request adds a convenient method for matching absence of form param in a request.
Usage example :
It was possible to verify the same even without this method as shown below, but felt counter-intuitive (given there is already a
withoutHeader
method).References
withoutHeader
and follows similar pattern.wiremock/src/main/java/com/github/tomakehurst/wiremock/matching/RequestPatternBuilder.java
Line 166 in 2f8b526
Add convenient method for matching absence of query param in a request #2192
It was necessary to add jackson annotation to prevent failure when de-serializing near-miss response.JSON changes are no longer needed.src/main/java/com/github/tomakehurst/wiremock/http/FormParameter.java
Submitter checklist