Search code examples
spring-cloudspring-cloud-contract

Spring Cloud Contract base64 image upload to long


How can we create a contract for an image upload in base 64? These base64 strings tend to get very long and we seem to get this exception:

String too long. The given string is 500000 Unicode code units long, but only a maximum of 65535 is allowed

Solution

  • Do you really need to upload such a gigantic image for a contract test? You want to use contract testing to just check whether your application can parse an image, not parse gigantic images. For the latter tests you can do integration testing. In my opinion you're misusing the tool.