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

API/method to overwrite specific request without using PUT api as it completely overwrites the entire data #992

Open
atif-github-venture opened this issue Oct 26, 2021 · 13 comments
Assignees

Comments

@atif-github-venture
Copy link

This appends the supplied simulation JSON to the existing simulation data in Hoverfly. Any pair that has request data identical to the existing ones will not be added.

As per the documentation POST adds the supplied JSON, but lets say I have need to overwrite the existing content just for single request match NOT the whole simulations set, and API suitable for just this will be helpful.

We are looking for alternative to our existing mock solution. So in hoverfly we are looking for a way to not bring down a service and also NOT overwrite the whole set, but for something which can support multiple team members to use the same service in their own way. And many a times we end up changing the stubbed data, so we can not afford to overwrite and disrupt others.

If you have more questions, please let me know.

@kapishmalik
Copy link
Collaborator

Hoverfly hardly takes any time to update the entire simulation data as it is in memory and takes exclusive locks before modifying the simulation data. It won't disrupt the other services but at times call will be slower.

You are probably asking for a PATCH call but there is no mechanism to identify that request/response pair.

@kapishmalik
Copy link
Collaborator

@tommysitu do you want to do this?

@tommysitu
Copy link
Member

@tommysitu do you want to do this?

We need a way to identify the request-response pair first. Have you got any idea?

@kapishmalik
Copy link
Collaborator

@tommysitu we can add auto generated id to each request response pair and identify using the same. What do you say?

@aahmedvictoria
Copy link

Hey guys, any update on this?

@kapishmalik
Copy link
Collaborator

@tommysitu what do you say about this?

we can add auto generated id to each request response pair and identify using the same. What do you say?

@tommysitu
Copy link
Member

you can compute a hash code for the request struct and use the code for checking equality.

@kapishmalik
Copy link
Collaborator

sure @tommysitu I can proceed in that way.

@kapishmalik kapishmalik self-assigned this Oct 16, 2024
@kapishmalik
Copy link
Collaborator

@atif-github-venture I will start working on this and get back with more updates.

@tommysitu
Copy link
Member

@kapishmalik what's your plan? Are you creating a new admin API or updating the POST simulation API?

@kapishmalik
Copy link
Collaborator

@tommysitu I am planning to create new PATCH admin API endpoint to update a particular request. Shall I go ahead with that?

@tommysitu
Copy link
Member

Cool, let's do a PATCH API that can merge the new data with the old data, so:

  • new pair will be added
  • existing request should have response updated to the new data.

We probably want to deprecated the POST API in the future, I don't know if that's useful or not, it has quite a lot of overlap with this new proposed PATCH API.

Thanks @kapishmalik

@kapishmalik
Copy link
Collaborator

Yup, that's an idea. I will get back in few days with PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants