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

Forward callbacks in capture mode #1161

Open
hertznsk opened this issue Dec 12, 2024 · 2 comments
Open

Forward callbacks in capture mode #1161

hertznsk opened this issue Dec 12, 2024 · 2 comments

Comments

@hertznsk
Copy link

Thanks for the wonderful tool!

Is your feature request related to a problem? Please describe.

We lack the ability to forward callbacks in capture mode.

In our scenario, our application sends requests to a remote service by passing a callback url. After a while, the service sends a callback request, which should be sent to our application.

It would be convenient if we could capture this request to have sample responses for further implementation of postServeAction.

Describe the solution you'd like

Add the option -forward <source url> <target_url>.

Record requests and responses in a data structure similar to pairs.

Describe alternatives you've considered

Currently, we have to implement logging in the application or on an external reverse proxy, or study the documentation of an external service, which makes the preparation of the mock somewhat longer.

Additional context
No

@kapishmalik
Copy link
Collaborator

kapishmalik commented Dec 12, 2024

I have some doubts.

How remote service will proxy the request to your hoverfly instance? Is that service you are owning?

How we will identify which callback refers to which request?

This won't be generic thing as no remote service will proxy request to our hoverfly instance so there is no point of adding that functionality just for very specific use case.

@tommysitu
Copy link
Member

tommysitu commented Dec 12, 2024

Thanks guys, there are some good ideas and valid concerns here. I think @hertznsk is suggesting a webhook capture and simulate feature which can probably utilize the existing postServeAction. I had a similar experience and felt frustrated doing webhook testing, especially if the webhook is difficult to trigger, so having some control over when and what webhook to generate would be awesome.

How remote service will proxy the request to your hoverfly instance? Is that service you are owning?

It's not gonna be a proxy, because remote server can only deliver a webhook to an endpoint, so Hoverfly needs to run a server to receive the request, and then replay it through a proxy to the user's application, the proxy will capture the request and response data.

How we will identify which callback refers to which request?

This is an issue, because webhook is asynchronous, there is no guarantee that it will deliver in certain order and time. One way you can associate a callback with a request is by using some sort of resource id in the webhook payload for correlation. But the possibility of doing that varies between different webhook providers and use cases.

Perhaps @hertznsk could tell us if the correlation between a request and a callback is achievable in his use case.

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

No branches or pull requests

3 participants