-
-
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.
feat: Support modifying the request metadata in the provider test bef…
…ore being sent to the plugin
- Loading branch information
1 parent
a43c2ea
commit 49f4d90
Showing
6 changed files
with
180 additions
and
76 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
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
38 changes: 38 additions & 0 deletions
38
provider/src/main/kotlin/au/com/dius/pact/provider/RequestDataToBeVerified.kt
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,38 @@ | ||
package au.com.dius.pact.provider | ||
|
||
import au.com.dius.pact.core.model.OptionalBody | ||
import io.pact.plugins.jvm.core.InteractionVerificationData | ||
|
||
/** | ||
* Request data that is going to be used by the plugin to create the request to be verified | ||
*/ | ||
interface RequestData { | ||
/** | ||
* Data for the request of the interaction | ||
*/ | ||
val requestData: OptionalBody | ||
|
||
/** | ||
* Metadata associated with the request | ||
*/ | ||
val metadata: Map<String, Any?> | ||
} | ||
|
||
/** | ||
* Data used by a plugin to create a request to be verified | ||
*/ | ||
data class RequestDataToBeVerified( | ||
/** | ||
* Data for the request of the interaction | ||
*/ | ||
override val requestData: OptionalBody, | ||
|
||
/** | ||
* Metadata associated with the request | ||
*/ | ||
override val metadata: Map<String, Any?> | ||
): RequestData { | ||
constructor(requestData: InteractionVerificationData) : this(requestData.requestData, requestData.metadata) | ||
|
||
fun asInteractionVerificationData() = InteractionVerificationData(requestData, metadata) | ||
} |