Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is wireMock.Net able to handle json files from folders under "__admin/mappings" directory?

Tags:

wiremock

I've developed a project using asp.net core 2.0 + wiremock.net. Currently, I'm able to handle json files under "__admin/mappings" directory only. However, I have several json files and because of that, I'd like to add one more folder under the "mappings" directory, for example "__admin/mappings/{anotherFolder}".

What I have:

 __admin/mappings/first.json
 __admin/mappings/second.json

What I would like to have:

 __admin/mappings/folder_A/first.json
 __admin/mappings/folder_A/second.json
 __admin/mappings/folder_B/first.json
 __admin/mappings/folder_B/second.json

I've tried to add one more folder under the "mappings" folder, but when I tried to reach the json route, I got a message "No matching mapping found". Is there any way to handle json files from different directories?

like image 767
Fernando Szezecinski Avatar asked Dec 21 '25 22:12

Fernando Szezecinski


1 Answers

I had to implement my own FileSystemHandler object and pass it on the FluentMockServerSettings constructor:

var stub = FluentMockServer.Start(
                new FluentMockServerSettings
                {
                    Urls = new[] {"http://+:5001" },
                    StartAdminInterface = true,
                    ReadStaticMappings = true,
                    WatchStaticMappings = true,
                    **FileSystemHandler = new CustomFileSystemFileHandler()**
                }
            );
like image 63
Fernando Szezecinski Avatar answered Dec 31 '25 17:12

Fernando Szezecinski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!