pact-foundation / pact-net

.NET version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://pact.io
MIT License
823 stars 225 forks source link

fix(#468): Allow non-ASCII chars on most user input #469

Closed adamrodger closed 4 months ago

adamrodger commented 11 months ago

Instead of trying to marshal strings, which don't marshal nicely over the FFI boundary because C# uses UTF-16 but Rust wants UTF-8, instead explicitly convert strings to a UTF-8 byte[] and marshal those.

Some places don't need to allow non-ASCII, such as the scheme in URLs, whereas others are very tricky, such as consumer filters. This would change the API to byte[][] and those can't be marshalled, so some parts still support non-ASCII for now. If that's a problem in the future then some custom marshalling could be implemented, but currently that seems overkill.

Closes #468

adamrodger commented 4 months ago

This is no longer compatible with PactNet 5.x and an alternative fix will be created instead.