-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Admin static json mappings #21
Comments
WireMock.Net.StandAlone |
Static Mappings using a json file is not yet implemented. I'll build this in some time using this thread for updates. |
Support added. See example project on how to use this. |
Nice :-)
I added a method to do it myself but hadn't tested enough to submit a PR.
Will get the latest when I'm back at work on Monday and try it out
Thanks!
On 10/02/2017 9:16 PM, "Stef Heyenrath" <[email protected]> wrote:
Support added.
See example project onhow to use this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#21 (comment)>,
or mute the thread
<https:/notifications/unsubscribe-auth/AEEFo1sFxFLZxkl-WZCNEiwxYz9UAt_Uks5rbBzAgaJpZM4L8zMR>
.
|
Did you have time to verify this? |
@phillee007 Is it working fine? |
finally got a chance to test this! To answer your question: yes and no... Yes it can read mappings files that are named using a guid, however, we find it useful to actually use meaningful file names, as we're generating a whole heap of static mappings based on log files from real requests/responses from our external api. E.g. customer_get_123.json vs asdfdsafsaf234324.json Is it possible for the static mappings reader to just read all .json files in the directory rather than forcing them to use a guid? Maybe add an optional filename property to the Mapping class so we can specify that if/when calling the admin api to add mappings at runtime too? Thanks, |
Good point. I will add support for all |
OK. I've added a "Title" as property. Can you please get the latest code and test if this works for you ? |
Were you able to test the latest code? |
Good news - I got to test this at last and it does work! Will raise another issue regarding the path matching and full urls separately |
Actually, scratch that comment re raising another issue. I see you've already added in the extra function to convert a relative url to the fully qualified url so that matcher works :-) E.g. If the request has something like this: When I was using the earlier version of wiremock.net, it required me to have the fully-qualified url in the Pattern otherwise it wouldn't find the match when I requested http://myserver:9090/products/123456. E.g. ... However, I see now that I can just specify the relative url and it works as per the regular WireMock documentation. Great work!!! We're now ready to use this fairly heavily so will let you know if we hit any other issues |
Thanks. Please open new issues in case you encounter something. |
Hi there,
I've downloaded the source zip, built the solution, and created an /__admin/mappings/ folder under the bin/debug folder for the WireMock.Net.StandAlone project. In there, I copied the basic json file from http://wiremock.org/docs/stubbing/ (as shown at the end) and named it test.json. I then ran the standalone project from the command line (after adding Newtonsoft.Json reference and restoring Nuget packages). The console runner shows the server is now listening on port 9090.
When I tried to browse to http://localhost:9090/some/thing it said "No mapping found", and also when I browse to http://localhost:9090/__admin/mappings it returned an empty array. Is it loading up the static json file mappings?
Thanks,
Phil
{
"request": {
"method": "GET",
"url": "/some/thing"
},
"response": {
"status": 200,
"body": "Hello world!",
"headers": {
"Content-Type": "text/plain"
}
}
}
The text was updated successfully, but these errors were encountered: