3

I am new to wiremock and would like to create permanent custom stubs. I was able to create stubs by running a standalone wiremock instance and sending post requests using curl commands to make the stubs. That works fine, but as soon as I restart the wiremock instance, all the stubs get lost. I was wondering if there was a way to make those stubs permanent, even after restarting the wiremock server.

When running wiremock for the first time, I tried doing record-mappings to permanently save the stubs, but that did not seem to work.

Thank you in advance!

Rayan Ahmed
  • 165
  • 2
  • 11

1 Answers1

4

When you add the stubs via curl (or the HTTP API generally), if you add a "persistent": true attribute to the stub JSON at the top level, WireMock will save it to disk.

Tom
  • 3,471
  • 21
  • 14
  • When using WireMock.Net, you can use `"SaveToFile": true`. See https://github.com/WireMock-Net/WireMock.Net/wiki/Admin-API-Reference#post---__adminmappings – Stef Heyenrath Jun 18 '19 at 12:04