-
-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use the raw URL path in the mock server as HttpExchange will dec…
…ode the path #1326
- Loading branch information
Ronald Holshausen
committed
Mar 27, 2021
1 parent
4f06881
commit 08d6518
Showing
6 changed files
with
72 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...junit5/src/test/groovy/au/com/dius/pact/consumer/junit5/PathWithValueWithSlashTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package au.com.dius.pact.consumer.junit5 | ||
|
||
import au.com.dius.pact.consumer.MockServer | ||
import au.com.dius.pact.consumer.dsl.PactDslWithProvider | ||
import au.com.dius.pact.core.model.RequestResponsePact | ||
import au.com.dius.pact.core.model.annotations.Pact | ||
import org.apache.http.HttpResponse | ||
import org.apache.http.client.fluent.Request | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
|
||
@ExtendWith(PactConsumerTestExt) | ||
@PactTestFor(providerName = 'PathWithValueWithSlashTest', port = '1234') | ||
class PathWithValueWithSlashTest { | ||
@Pact(consumer = 'Consumer') | ||
RequestResponsePact filesPact(PactDslWithProvider builder) { | ||
builder | ||
.uponReceiving('a request with a slash in the path') | ||
.path('/endpoint/Some%2FValue') | ||
.willRespondWith() | ||
.status(200) | ||
.toPact() | ||
} | ||
|
||
@Test | ||
void testFiles(MockServer mockServer) { | ||
HttpResponse httpResponse = Request.Get("${mockServer.url}/endpoint/Some%2FValue") | ||
.execute().returnResponse() | ||
assert httpResponse.statusLine.statusCode == 200 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters