Skip to content

Commit

Permalink
feat: update readme about override for handling a content type as binary
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Holshausen committed Jun 17, 2020
1 parent 0b774ea commit 2333d23
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
9 changes: 9 additions & 0 deletions consumer/groovy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,15 @@ For example:
}
```

### Overriding the handling of a body data type

**NOTE: version 4.1.3+**

By default, bodies will be handled based on their content types. For binary contents, the bodies will be base64
encoded when written to the Pact file and then decoded again when the file is loaded. You can change this with
an override property: `pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`. For instance, setting
`pact.content_type.override.application.pdf=text` will treat PDF bodies as a text type and not encode/decode them.

## Changing the directory pact files are written to

By default, pact files are written to `target/pacts` (or `build/pacts` if you use Gradle), but this can be overwritten with the `pact.rootDir` system property.
Expand Down
9 changes: 9 additions & 0 deletions consumer/junit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,15 @@ DslPart body = new PactDslJsonBody()

The `and` and `or` methods take a variable number of matchers (varargs).

### Overriding the handling of a body data type

**NOTE: version 4.1.3+**

By default, bodies will be handled based on their content types. For binary contents, the bodies will be base64
encoded when written to the Pact file and then decoded again when the file is loaded. You can change this with
an override property: `pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`. For instance, setting
`pact.content_type.override.application.pdf=text` will treat PDF bodies as a text type and not encode/decode them.

### Matching on paths

You can use regular expressions to match incoming requests. The DSL has a `matchPath` method for this. You can provide
Expand Down
11 changes: 10 additions & 1 deletion provider/gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ The following project properties can be specified with `-Pproperty=value` on the
|`pact.verifier.disableUrlPathDecoding`|Disables decoding of request paths|
|`pact.pactbroker.httpclient.usePreemptiveAuthentication`|Enables preemptive authentication with the pact broker when set to `true`|
|`pact.provider.tag`|Sets the provider tag to push before publishing verification results|

|`pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`|Overrides the handling of a particular content type [4.1.3+]|

## Specifying the provider hostname at runtime

Expand Down Expand Up @@ -345,6 +345,15 @@ behaviour off, set the property `pact.verifier.disableUrlPathDecoding` to `true`
__*Important Note:*__ If you turn off the url path decoding, you need to ensure that the paths in the pact files are
correctly encoded. The verifier will not be able to make a request with an invalid encoded path.

## Overriding the handling of a body data type

**NOTE: version 4.1.3+**

By default, bodies will be handled based on their content types. For binary contents, the bodies will be base64
encoded when written to the Pact file and then decoded again when the file is loaded. You can change this with
an override property: `pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`. For instance, setting
`pact.content_type.override.application.pdf=text` will treat PDF bodies as a text type and not encode/decode them.

## Provider States

For a description of what provider states are, see the pact documentations: http://docs.pact.io/documentation/provider_states.html
Expand Down
9 changes: 9 additions & 0 deletions provider/junit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,15 @@ to `true`.
** WARNING! Do not enable this on your CI server, as this could result in your build passing with no providers
having been verified due to a configuration error. **

### Overriding the handling of a body data type

**NOTE: version 4.1.3+**

By default, bodies will be handled based on their content types. For binary contents, the bodies will be base64
encoded when written to the Pact file and then decoded again when the file is loaded. You can change this with
an override property: `pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`. For instance, setting
`pact.content_type.override.application.pdf=text` will treat PDF bodies as a text type and not encode/decode them.

## Test target

The field in test class of type `au.com.dius.pact.provider.junit.target.Target` annotated with `au.com.dius.pact.provider.junit.target.TestTarget`
Expand Down
9 changes: 9 additions & 0 deletions provider/junit5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,15 @@ By default, the test will fail with an exception if no pacts were found to verif
`@IgnoreNoPactsToVerify` annotation to the test class. For this to work, you test class will need to be able to receive
null values for any of the injected parameters.

## Overriding the handling of a body data type

**NOTE: version 4.1.3+**

By default, bodies will be handled based on their content types. For binary contents, the bodies will be base64
encoded when written to the Pact file and then decoded again when the file is loaded. You can change this with
an override property: `pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`. For instance, setting
`pact.content_type.override.application.pdf=text` will treat PDF bodies as a text type and not encode/decode them.

# Pending Pact Support (version 4.1.0 and later)

If your Pact broker supports pending pacts, you can enable support for that by enabling that on your Pact broker
Expand Down
10 changes: 10 additions & 0 deletions provider/maven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ The following plugin properties can be specified with `-Dproperty=value` on the
|`pact.verifier.disableUrlPathDecoding`|Disables decoding of request paths|
|`pact.pactbroker.httpclient.usePreemptiveAuthentication`|Enables preemptive authentication with the pact broker when set to `true`|
|`pact.consumer.tags`|Overrides the tags used when publishing pacts [version 4.0.7+]|
|`pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`|Overrides the handling of a particular content type [version 4.1.3+]|

Example in the configuration section:

Expand Down Expand Up @@ -737,6 +738,15 @@ For example:
</plugin>
```

### Overriding the handling of a body data type

**NOTE: version 4.1.3+**

By default, bodies will be handled based on their content types. For binary contents, the bodies will be base64
encoded when written to the Pact file and then decoded again when the file is loaded. You can change this with
an override property: `pact.content_type.override.<TYPE>.<SUBTYPE>=text|binary`. For instance, setting
`pact.content_type.override.application.pdf=text` will treat PDF bodies as a text type and not encode/decode them.

# Publishing verification results to a Pact Broker

For pacts that are loaded from a Pact Broker, the results of running the verification can be published back to the
Expand Down

0 comments on commit 2333d23

Please sign in to comment.