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

Multipart: boundary should not be random #322

Closed
tienvx opened this issue Sep 16, 2023 · 1 comment · Fixed by #323
Closed

Multipart: boundary should not be random #322

tienvx opened this issue Sep 16, 2023 · 1 comment · Fixed by #323

Comments

@tienvx
Copy link
Contributor

tienvx commented Sep 16, 2023

Currently boundary is random, so the pact is generated differently each time I run consumer test:

diff --git a/example/multipart/pacts/multipartConsumer-multipartProvider.json b/example/multipart/pacts/multipartConsumer-multipartProvider.json
index eb2fcc3..9dca32f 100644
--- a/example/multipart/pacts/multipartConsumer-multipartProvider.json
+++ b/example/multipart/pacts/multipartConsumer-multipartProvider.json
@@ -11,11 +11,11 @@
         }
       ],
       "request": {
-        "body": "LS1rdEptZVlIYmtUU2ExanhEDQpDb250ZW50LURpc3Bvc2l0aW9uOiBmb3JtLWRhdGE7IG5hbWU9ImZ1bGxfbmFtZSI7IGZpbGVuYW1lPSJwYWN0dmZhU1JiIg0KQ29udGVudC1UeXBlOiBhcHBsaWNhdGlvbi9vY3RldC1zdHJlYW0NCg0KQ29sdGVuIFppZW1hbm4NCi0ta3RKbWVZSGJrVFNhMWp4RA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJwcm9maWxlX2ltYWdlIjsgZmlsZW5hbWU9ImltYWdlLmpwZyINCkNvbnRlbnQtVHlwZTogaW1hZ2UvanBlZw0KDQr/2P/gABBKRklGAAEBAAABAAEAAP/bAEMAAwICAgICAwICAgMDAwMEBgQEBAQECAYGBQYJCAoKCQgJCQoMDwwKCw4LCQkNEQ0ODxAQERAKDBITEhATDxAQEP/AAAsIAAwADAEBEQD/xAAWAAEBAQAAAAAAAAAAAAAAAAAEAAX/xAAiEAACAQMDBQEAAAAAAAAAAAABAwIEERIABSEGEyIjQRT/2gAIAQEAA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BysOSR80euY9O3L3oOymKamrAkqWFjOEGFfERLtgyIAyvb7fnWAmoqnMqR+6tV26lsPRWOTGXmTfGEhEHn4AOBxr/9kNCi0tZ3BEdEV2b3Q0bWEzRURVcA0KQ29udGVudC1EaXNwb3NpdGlvbjogZm9ybS1kYXRhOyBuYW1lPSJwZXJzb25hbF9ub3RlIjsgZmlsZW5hbWU9InBhY3RydXlTblciDQpDb250ZW50LVR5cGU6IGFwcGxpY2F0aW9uL29jdGV0LXN0cmVhbQ0KDQp0ZXN0aW5nDQotLWdwRHRFdm90NG1hM0VEVXAtLQ0K",
         "headers": {
           "Accept": "application/json",
           "Authorization": "Bearer eyJhbGciOiJIUzI1NiIXVCJ9",
-          "Content-Type": "multipart/form-data; boundary=ktJmeYHbkTSa1jxD"
+          "Content-Type": "multipart/form-data; boundary=gpDtEvot4ma3EDUp"
         },
         "matchingRules": {
           "body": {

Here is how to reproduce it:

  • git clone https://github.com/pact-foundation/pact-php.git
  • cd pact-php
  • git checkout ffi
  • composer install
  • cd example/multipart/consumer/
  • PACT_LOGLEVEL=trace phpunit
  • Expected: the generated pact file example/multipart/pacts/multipartConsumer-multipartProvider.json should not be changed
  • Actual: the generated pact file example/multipart/pacts/multipartConsumer-multipartProvider.json is changed because of the dynamic boundary

According to this article this behavior should be avoid.

@tienvx
Copy link
Contributor Author

tienvx commented Sep 16, 2023

I have tried several solutions:

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

Successfully merging a pull request may close this issue.

1 participant