Files
spring-cloud-contract/docs/modules/ROOT/pages/project-features-flows/jax-rs.adoc
Marcin Grzejszczak 43318b0b05 Done
2023-09-11 19:00:22 +02:00

29 lines
783 B
Plaintext

[[features-jax-rs]]
= JAX-RS
include::partial$_attributes.adoc[]
The Spring Cloud Contract supports the JAX-RS 2 Client API. The base class needs
to define `protected WebTarget webTarget` and server initialization. The only option for
testing JAX-RS API is to start a web server. Also, a request with a body needs to have a
content type be set. Otherwise, the default of `application/octet-stream` gets used.
To use JAX-RS mode, use the following setting:
====
[source,groovy,indent=0]
----
testMode = 'JAXRSCLIENT'
----
====
The following example shows a generated test API:
====
[source,groovy,indent=0]
----
include::{verifier_root_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/JaxRsClientMethodBuilderSpec.groovy[tags=jaxrs,indent=0]
----
====