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

feat: allow multipart parts with content types #1929

Draft
wants to merge 241 commits into
base: 4.0.x
Choose a base branch
from

Conversation

adrianhj
Copy link
Contributor

@adrianhj adrianhj commented Aug 17, 2023

WIP implementation for commentary of an alternative approach for multipart/form-data support based off of the back of #1888 backed by WireMock's multipart support vs generating a regex against the request parts.

Looking to pick this back up and progress if there is interest with some guidance.

DSL wise aim would be to provide something closer to the multipart/form-data spec to give a bit more freedom than currently possible, such as the following for a scenario of sending a correctly structured JSON metadata part and a file part in the request.

multipart(
    metadata: part(
        value: "{...}",
        contentType: "application/json",
    ),
    file: part(
        value: <file>,
        filename: "example.pdf",
        contentType: "application/pdf"
    )
)

spencergibb and others added 30 commits January 14, 2022 11:18
* Updates to version 4.0.0-SNAPSHOT

Updates to Java 17, framework 6, boot 3 and Jakarta EE

Missing support for versions of rest assured, activemq-pool & jersey-client

* Additional jdk17, spring cloud 2021, boot 3 upgrades

* Fixed invalid version

Co-authored-by: Marcin Grzejszczak <marcin@grzejszczak.pl>
Co-authored-by: Marcin Grzejszczak <mgrzejszczak@vmware.com>
Bumps xercesImpl from 2.12.0 to 2.12.2.

---
updated-dependencies:
- dependency-name: xerces:xercesImpl
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…1755)

* docs: Explain how to have multiple contracts in Groovy

* Update _project-features-contract.adoc

Co-authored-by: Marcin Grzejszczak <marcin@grzejszczak.pl>
@@ -75,51 +64,10 @@ public static DslProperty asDslProperty(Object o) {
return new DslProperty(o);
}

public DslProperty getName() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see these methods in the new parent class. If we don't leave them then we will have a breaking change (which we should avoid)

@@ -94,29 +94,6 @@ protected static Pattern anyOf(String... values) {
.collect(Collectors.joining("|")));
}

public static String multipartParam(Object name, Object value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a breaking change

@@ -716,26 +716,28 @@ then:

assertThat(multipartData["file1"]).isInstanceOf(NamedProperty::class.java)
namedProperty = multipartData["file1"] as NamedProperty
assertThat(((namedProperty.name as DslProperty<Any>).clientValue as RegexProperty).pattern()).isEqualTo("[\\S\\s]+")
Copy link
Contributor

Choose a reason for hiding this comment

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

Breaking change

@marcingrzejszczak
Copy link
Contributor

Also since this is a new feature I think we should add it to main, WDYT ?

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

Successfully merging this pull request may close these issues.