smocker-dev / smocker

Smocker is a simple and efficient HTTP mock server and proxy
https://smocker.dev
MIT License
1.16k stars 61 forks source link

Edit mock? #231

Closed alex-LE closed 2 years ago

alex-LE commented 2 years ago

Hey, is there a way to edit a mock after creating it within the UI? Or even to delete it (without resetting the whole session) and create a new one?

Thiht commented 2 years ago

Hi, There's currently no way to edit a mock. It was not planned to ever allow it initially but we might implement it once we merge https://github.com/Thiht/smocker/pull/210 (we need to discuss it with @gwleclerc though because impacts are not trivially mitigated)

For now, the mocks in a session are append-only: no edit, no delete.

gwleclerc commented 2 years ago

To explain a bit more, Smocker was designed for testing and in this use case I have trouble finding a good reason to allow modification. How does the session vérification behave if the mock has been modified? Do we keep the link between the history entry and the mock if it has been modified? Overall, does it make sense to modify a mock in the middle of a test session?

Modifying or deleting a mock if the history is empty may be possible but once calls have been made it doesn't make much sense to me.

alex-LE commented 2 years ago

I totally agree.

As there is already the option to store the mocks in a file and load that on smocker start, thats fine. Its even possible to use the GUI to create the yaml content.

Thanks guys.