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

Using request multipart in response template #968

Closed
rmeshksar opened this issue Jul 17, 2023 · 7 comments
Closed

Using request multipart in response template #968

rmeshksar opened this issue Jul 17, 2023 · 7 comments
Assignees
Labels

Comments

@rmeshksar
Copy link
Contributor

Hi,
The content-type of the request is
multipart/form-data; boundary=4f5cb47fa8f04c7f91424474f070f497+1110027

Each section of multipart is an XML like this:

--4f5cb47fa8f04c7f91424474f070f497+1110027
Content-Disposition: form-data; name="N1"

<xml></xml>

--4f5cb47fa8f04c7f91424474f070f497+1110027
Content-Disposition: form-data; name="N2"

<xml></xml>

--4f5cb47fa8f04c7f91424474f070f497+1110027
Content-Disposition: form-data; name="N3"

<xml></xml>

--4f5cb47fa8f04c7f91424474f070f497+1110027--

In the response template I would like to use XPath to get some information of specific section.

Is it possible?

@StefH StefH changed the title Using request multipart in resposnse template Using request multipart in response template Jul 19, 2023
@StefH
Copy link
Collaborator

StefH commented Jul 19, 2023

Currently there is no special logic to parse a multipart and extract the parts. I'll need to think on this how to could be added and how this could be used.

@StefH StefH added feature and removed question labels Jul 19, 2023
@StefH
Copy link
Collaborator

StefH commented Jul 25, 2023

@rmeshksar
I'm building support for multipart request matching using MimeKitLite, and I think I can also use this in the templating...

@StefH
Copy link
Collaborator

StefH commented Jul 28, 2023

@rmeshksar

You can use preview version 1.5.32-ci-17678 where you can access request.BodyAsMimeMessage which is a MimeMessage from MimeKitLite.

https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions

@StefH
Copy link
Collaborator

StefH commented Jul 31, 2023

@rmeshksar
Did you have time to test this preview version?

@StefH
Copy link
Collaborator

StefH commented Aug 3, 2023

@rmeshksar
Did you have time to test this preview version?

It would really help if you can try this version before I merge to this main and create a new official version.

@StefH
Copy link
Collaborator

StefH commented Aug 3, 2023

#981

@StefH StefH closed this as completed Aug 3, 2023
@StefH StefH self-assigned this Aug 3, 2023
@eetawil
Copy link

eetawil commented Feb 13, 2024

Hi @StefH, would this PR solve my problem here: https://stackoverflow.com/questions/77989392/wiremock-net-c-how-to-get-a-pdf-from-a-request-body-form-data

Also is part of the latest nuget package 1.5.47?

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

No branches or pull requests

3 participants