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

[Feature request] Running request folder via Plugin API should show latest response data #6512

Open
1 task done
jreyesr opened this issue Sep 16, 2023 · 1 comment
Open
1 task done
Labels
A-plugin-api Area: Plugin API / System C-improvement Category: Improvement / Enhancement S-verified Status: Verified by maintainer

Comments

@jreyesr
Copy link

jreyesr commented Sep 16, 2023

Expected Behavior

When a plugin triggers a request (via network.sendRequest), that response should appear on the response history dropdown, as the responses of manually-triggered requests do.

Actual Behavior

Plugin-initiated responses don't appear on the history dropdown until a request is sent manually (with the Send button), at which point all the responses that were caused by the plugin, plus the recently-made manual request, all appear at once

Reproduction Steps

  1. Install a plugin that programmatically makes requests (see on Additional information for a minimal repro). The Send Request example in the docs is enough to cause the issue
  2. Create a new request
  3. Execute the plugin on the request (via the request's context menu)
  4. The response history for the request should contain a new entry, but it doesn't. If it was the first call of the request (or the first call after clearing the history) the button for the history dropdown won't even appear (as it doesn't if there are no responses yet)
  5. Manually send the request
  6. The history button will appear and contain two entries (one for the plugin-initiated response, and one for the manual one)

Is there an existing issue for this?

Additional Information

This was reported on a Insomnia plugin that I maintain. See jreyesr/insomnia-plugin-batch-requests#10. However, I can reproduce it with a very simple plugin too, taken directly from the docs, so it appears to be general and thus I'm reporting it here.

To reproduce the issue, you can use the following minimal plugin:

package.json
{
  "name": "insomnia-plugin-repro-history",
  "version": "0.0.1",
  "private": true,
  "insomnia": {
    "name": "repro-history",
    "description": ""
  },
  "main": "main.js"
}
main.js
module.exports.requestActions = [
  {
    label: "Send request",
    action: async (context, data) => {
      const { request } = data;
      const response = await context.network.sendRequest(request);
      const html = `<code>${request.name}: ${response.statusCode}</code>`;
      context.app.showGenericModalDialog("Results", { html });
    },
  },
];

Insomnia Version

2023.5.8

What operating system are you using?

Windows

Operating System Version

Ubuntu 22.04

Installation method

APT (.deb file)

Last Known Working Insomnia version

2022.5.7

@jreyesr jreyesr added B-bug Bug: general classification S-unverified Status: Unverified by maintainer labels Sep 16, 2023
@jreyesr
Copy link
Author

jreyesr commented Sep 16, 2023

Some further information: if I switch to another request and then switch back, the history does appear as expected. Presumably unmounting and remounting the React component causes it to rerender with the most recent data?

@filfreire filfreire changed the title Plugin-initiated requests don't appear immediately on response history [Feature request] Running request folder via Plugin API should show latest response data Sep 27, 2023
@filfreire filfreire added C-improvement Category: Improvement / Enhancement A-plugin-api Area: Plugin API / System S-verified Status: Verified by maintainer and removed B-bug Bug: general classification S-unverified Status: Unverified by maintainer labels Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-plugin-api Area: Plugin API / System C-improvement Category: Improvement / Enhancement S-verified Status: Verified by maintainer
Projects
None yet
Development

No branches or pull requests

2 participants