Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Feature Request] cancelHook #1608

Closed
PieterJanVanAeken opened this issue Jul 22, 2019 · 3 comments
Closed

[Feature Request] cancelHook #1608

PieterJanVanAeken opened this issue Jul 22, 2019 · 3 comments
Labels
N-discussion Needs: Discussion

Comments

@PieterJanVanAeken
Copy link

  • Insomnia Version: 6.5.4
  • Operating System: Elementary OS 5.0

Details

I think it could be useful to make available cancel hooks in the plugins, similar to the response hooks.

Use case:

When I do not specify a storage key in the prompt plugin, I expect to get reprompted for every request. This works fine, provided the request results in a response, which cleans up the cache through the response hook.

However, if I cancel the request (for instance, because it cannot be fulfilled and I do not want to enforce timeouts), I need to restart the application to clear the cache.

I could (and have) modified the prompt plugin to include a flag to reprompt every time, but this is not the ideal behaviour either as prompts could be rendered multiple times for a single request.

The ideal solution would be to have a form of cancelHook, which allows for cleanup of the cache upon cancellation of the request.

@welcome
Copy link

welcome bot commented Jul 22, 2019

👋 Thanks for opening your first issue! If you're reporting a 🐞 bug, please make sure
you include steps to reproduce it. If you're requesting a feature 🎁, please provide real
use cases that would benefit. 👪

To help make this a smooth process, please be sure you have first read the
contributing guidelines.

@gschier
Copy link
Contributor

gschier commented Jul 24, 2019

This should definitely be addressed. Thank you for pointing it out. It's quite an edge case.

The reason it currently doesn't work is because canceling the prompt modal causes the render step to fail, resulting in an exception, which then does not go through the response hooks. There may be other reasons why exceptions are thrown as well. For example, general render errors, misconfigured settings, validation errors, etc.

I think a generic requestErrorHooks plugin API would do the trick. Thoughts?

@gschier gschier added Accepted 👌 N-discussion Needs: Discussion labels Jul 24, 2019
@PieterJanVanAeken
Copy link
Author

I have now noticed it also happens when you make a typo and you get exceptions such as hostname could not be resolved so indeed, a general requestErrorHooks plugin could make sense.

@wdawson wdawson closed this as completed Jun 30, 2021
@Kong Kong locked and limited conversation to collaborators Jun 30, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
N-discussion Needs: Discussion
Projects
None yet
Development

No branches or pull requests

3 participants