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

Assign Variable in Request Body (Canned JSON File) #646

Closed
devmariodiaz opened this issue Oct 7, 2021 · 9 comments
Closed

Assign Variable in Request Body (Canned JSON File) #646

devmariodiaz opened this issue Oct 7, 2021 · 9 comments
Labels

Comments

@devmariodiaz
Copy link

Hello Stef,

I hope everything is doing well.

Could you please let me know if there is a way to replace "Pattern" parameter in post request with a filename i.e "request.xml" or variable?
I really appreciate it
i.e "PatternAsFile": "requestbody.xml" such as Request Templating.

SOAPconfiguration.json.zip

@devmariodiaz devmariodiaz changed the title Escape characters inside Matcher pattern Assign Variable in Request Body (Canned JSON File) Oct 7, 2021
@StefH
Copy link
Collaborator

StefH commented Oct 8, 2021

Hello Mario.
This is not yet implemented.

This can be done like you propose:

"Body": {
  "Matcher": {
	"Name": "ExactMatcher",
	"PatternAsFile": "requestbody.xml"
  }
}

Another option would be:

"Body": {
  "Matcher": {
	"Name": "ExactMatcher",
	"Pattern": {
              "WithFile": "requestbody.xml",
              "FromFile": "requestbody.xml",
              "UsingFile": "requestbody.xml",
        }
  }
}

@StefH
Copy link
Collaborator

StefH commented Oct 9, 2021

Hello @devmariodiaz,

I think that "PatternAsFile": "requestbody.xml" is the most logical option. Do you agree?

@devmariodiaz
Copy link
Author

Thanks, Stef for your dedicated time.

I'll test this great solution

@StefH
Copy link
Collaborator

StefH commented Oct 11, 2021

(Note that PatternAsFile is not yet implemented, so you cannot test that)

@devmariodiaz
Copy link
Author

I got it 👍

@StefH
Copy link
Collaborator

StefH commented Oct 12, 2021

#651

@StefH
Copy link
Collaborator

StefH commented Oct 12, 2021

Hello @devmariodiaz ,

I've created a preview version 1.4.23-ci-15479 which should implement this.

For info on preview versions ; see https:/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions

@devmariodiaz
Copy link
Author

Hello Stef,

I was testing this solution and it's working fine, would you please incorporate this feature in the next version.

Thanks a lot for your time.

@StefH
Copy link
Collaborator

StefH commented Oct 15, 2021

Hello Mario,
Thanks for testing, I'll merge this code.

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

2 participants