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

Record&Replay - Support for multipart/related without Content-Disposition headers #2264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hladysz
Copy link

@hladysz hladysz commented Jul 12, 2023

Support for multipart/related without Content-Disposition headers - recording and replaying

References

Submitter checklist

  • The PR request is well described and justified, including the body and the references
  • The PR title represents the desired changelog entry
  • The repository's code style is followed (see the contributing guide)
  • Test coverage that demonstrates that the change works as expected
  • For new features, there's necessary documentation in this pull request or in a subsequent PR to wiremock.org

@hladysz hladysz requested a review from a team as a code owner July 12, 2023 15:03
@oleg-nenashev oleg-nenashev changed the title [ISSUE-2260] Support for multipart/related without Content-Dispositio… Record&Replay - Support for multipart/related without Content-Disposition headers Jul 22, 2023
Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds about right from the code. I haven't tested it, but the potential impact is isolated enough

@@ -421,7 +421,7 @@ public void decompressesGzippedResponseBodyAndRemovesContentEncodingHeader() {
+ " \"url\": \"/multipart/content\", \n"
+ " \"multipartPatterns\" : [ { \n"
+ " \"name\" : \"binaryFile\", \n"
+ " \"matchingType\" : \"ALL\", \n"
+ " \"matchingType\" : \"ANY\", \n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change really needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking

Copy link
Author

@hladysz hladysz Jul 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's an example of mis-match in src/test/java/com/github/tomakehurst/wiremock/matching/RequestPatternTest.java#doesNotMatchExactlyWhenManyMultipartPatternsSupposeToMatchAllDistinctParts() that test is using the default value which is to match ALL parts.

It was changed in the recorder to match ANY part in src/main/java/com/github/tomakehurst/wiremock/stubbing/StubMappingJsonRecorder.java:102

@tomakehurst
Copy link
Member

This fixes the (now deprecated) legacy recorder, which we'll be removing soon.

Does this issue affect the current recorder, and if so could we fix it there instead?

@hladysz
Copy link
Author

hladysz commented Jul 22, 2023

This fixes the (now deprecated) legacy recorder, which we'll be removing soon.

Does this issue affect the current recorder, and if so could we fix it there instead?

Thanks. Where can I find the new and improved recorder?

@tomakehurst
Copy link
Member

com.github.tomakehurst.wiremock.recording.Recorder is the place to start for the new one

@hladysz
Copy link
Author

hladysz commented Jul 24, 2023

com.github.tomakehurst.wiremock.recording.Recorder is the place to start for the new one

looking.

@hladysz
Copy link
Author

hladysz commented Jul 24, 2023

com.github.tomakehurst.wiremock.recording.Recorder is the place to start for the new one

This one can't be executed in a standalone version, can it?

@hladysz
Copy link
Author

hladysz commented Jul 24, 2023

com.github.tomakehurst.wiremock.recording.Recorder is the place to start for the new one

If this is what I think it is (

) then it would be a lot of work to support multipart in there. Can I pair with someone if that needs to be done as a part of this fix?

@hladysz
Copy link
Author

hladysz commented Jul 24, 2023

Unless we can copy the same logic
from here:

if (request.isMultipart() && request.getParts() != null) {

into here:
if (bodyPatternFactory != null && body != null && body.length > 0) {

@hladysz
Copy link
Author

hladysz commented Jul 24, 2023

Not too sure what's the significance of this one:

@tomakehurst
Copy link
Member

com.github.tomakehurst.wiremock.recording.Recorder is the place to start for the new one

This one can't be executed in a standalone version, can it?

Yes it can, but you start it via an API call or from the recorder UI page, rather than via the CLI.

@hladysz
Copy link
Author

hladysz commented Jul 25, 2023

com.github.tomakehurst.wiremock.recording.Recorder is the place to start for the new one

This one can't be executed in a standalone version, can it?

Yes it can, but you start it via an API call or from the recorder UI page, rather than via the CLI.

Thank you for your response.

@oleg-nenashev
Copy link
Member

@hladysz @tomakehurst I guess this PR is a no-go since the old recorder is now deprecated, right?

@hladysz
Copy link
Author

hladysz commented Aug 28, 2023 via email

@oleg-nenashev oleg-nenashev added the needs-tom Tom's Train Project :) label Sep 7, 2023
@oleg-nenashev
Copy link
Member

Thanks @hladysz . I will review it with the team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-tom Tom's Train Project :)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants