Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add Option to Customize Jackson StreamReadConstraints in Wiremock Standalone #2651

Open
BenniG82 opened this issue Mar 28, 2024 · 0 comments

Comments

@BenniG82
Copy link

Proposal

Hello,

I'd like to suggest a feature for Wiremock Standalone that allows users to customize the Jackson StreamReadConstraints, specifically to adjust settings like maxStringLength. This setting limits the size of the JSON-Strings that could be parsed by Jackson.

Currently, for those of us using Wiremock in its embedded form, it's straightforward to modify these constraints with the following code snippet before starting Wiremock:

StreamReadConstraints.overrideDefaultStreamReadConstraints(
    StreamReadConstraints.builder().maxStringLength(100_000_000).build()
);

However, this flexibility seems to be missing in the standalone version of Wiremock. While I understand that this issue stems more from Jackson than Wiremock itself, the ability to adjust these settings is crucial for our use case. We're dealing with some large mapping files, and being able to override the default maxStringLength setting would greatly help us.

Using Files larger than 20_000_000 bytes (Jacksons Defaut) leads to errors like this one:

Caused by: com.github.tomakehurst.wiremock.standalone.MappingFileException: Error loading file big_mapping_file.json:
String value length (20053313) exceeds the maximum allowed (20000000, from `StreamReadConstraints.getMaxStringLength()`)
	at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsSource.loadMappingsInto(JsonFileMappingsSource.java:126)
	at com.github.tomakehurst.wiremock.core.WireMockApp.loadMappingsUsing(WireMockApp.java:265)
	at com.github.tomakehurst.wiremock.core.WireMockApp.loadDefaultMappings(WireMockApp.java:259)
	at com.github.tomakehurst.wiremock.core.WireMockApp.<init>(WireMockApp.java:124)
	at com.github.tomakehurst.wiremock.WireMockServer.<init>(WireMockServer.java:71)

References

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant