-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Don't print non-utf8 bodies A lot of our services take in multipart data or binary data in the HTTP body and when a wiremock predicate fails megabytes of binary data get printed out to the console. Here I address this by not printing out a string if it isn't valid utf8 and instead printing out the body length. Another alternative may be to put in an upper limit to how large a body will be printed and if it exceeds that size maybe saving the request to a file for later analysis. But this change was so simple I figured I'd open the PR first to start the discussion. * Remove need for clone * Apply some PR feature suggestions 1. Setting limit via env var or builder 2. Having a default length limit 3. Printed suggestion on upping the limit * Update src/request.rs Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> * Apply feedback with BodyPrintLimit enum * Expand to try and find valid printable byte * Update src/request.rs Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com> * Update src/mock_server/builder.rs --------- Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
- Loading branch information
1 parent
443a585
commit 698cd76
Showing
3 changed files
with
90 additions
and
4 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