Gutter icon to run HTTP requests runs wrong request

If you have an HTTP file with two requests and you attempt to run the second request by clicking on the green gutter arrow icon while the cursor is on the first request, there's this annoying bug that PhpStorm will not execute the request that corresponds to the icon pressed but, instead, the request where the cursor is.

For me it's 100% reproducible and it's been like this for a long while (not caused by any recent version). Is there an open ticket for this?

0
8 comments

Hi there,

This is the only ticket that I could find (does not mean that there are no other ones if they did not show up in my search queries).

https://youtrack.jetbrains.com/issue/IDEA-288972

It says fixed in 2022.1 version (the latest is 2023.2.2 which is 5 versions newer)

1

It seems to be really fixed as I was not able to reproduce it on 2023.2.2

Alvaro Just to confirm, what IDE version are you using? If it is >2022.1, would it be possible to record a short screencast?

0

Latest stable (I'm using the app to keep it up to date).

PhpStorm 2023.2.2
Build #PS-232.9921.55, built on September 15, 2023
Licensed to ************************
Subscription is active until February 16, 2024.
Runtime version: 17.0.8+7-b1000.22 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.2.0-34-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1918M
Cores: 16
Registry:
   debugger.watches.in.variables=false
   run.processes.with.pty=TRUE
   documentation.show.toolbar=true

Non-Bundled Plugins:
   FrameSwitcher (4.2.0-232.7295)
   lermitage.intellij.ilovedevtoys (1.9.1)
   com.intellij.ideolog (222.1.0.0)
   String Manipulation (9.11.3)
   com.kalessil.phpStorm.phpInspectionsEA (5.0.0.0)
   ru.adelf.idea.dotenv (2023.2)
   net.king2500.plugins.PhpAdvancedAutoComplete (1.1.0)
   de.espend.idea.php.annotation (9.4.0)
   lv.midiana.misc.phpstorm-plugins.deep-keys (2022.08.03.001)
   fr.adrienbrault.idea.symfony2plugin (2022.1.258)
   com.ppolivka.plugin.gitcleaner (1.1.4)
   mobi.hsz.idea.gitignore (4.5.2)

Current Desktop: KDE

I'm unable to reproduce it when I try to create a simplified test case to showcase. It must be something triggered by my specific scripts, or bad indexes, or who knows. If I get something useful I'll share it with you.

0

Ran into this issue today with IDEA 2023.3.5 Ultimate on Apple Silicon

IntelliJ IDEA 2023.2.5 (Ultimate Edition)
Build #IU-232.10227.8, built on November 9, 2023
Runtime version: 17.0.9+7-b1000.46 aarch64

0

As I mentioned above, I was not able to reproduce it on recent IDE builds, at least, with a simple test scenarios :(

It would be great if you could record a short screencast on provide a sample .http file where it is clearly reproducible.

0

I tried to extract a minimal/redacted example for this bug based on the larger production script but in this sample I cannot reproduce it. In the production script, the issue is still visible. Thus, I try to share some observations that might help for now.

The first request uses an inline script response handler similar to  “Requests with authorization” sample. 

```

### Authorization by token, part 1. Retrieve and save token.
POST https://ijhttp-examples.jetbrains.com/post
Content-Type: application/json

{
  "token": "my-secret-token"
}

> {% client.global.set("auth_token", response.body.json.token); %}

```

The next requests are pretty regular GETs that make use of this token in the Authorization header.  No matter where the cursor stands, it always executes the correct request of the matching run button. 

The issue only happens at a later request in the file after one request that uses a referenced script (response handler) to extract some nested data.

```

### Get specific gateway details
GET {{api_url}}/gateways/{{sample_gateway}}
Authorization: Bearer {{access_token}}
Cache-Control: max-age=0

> scripts/extract-csr.js

```

Script content

```

if (response.status !== 200) {
    client.log("invalid status")
} else {
    const csr = response.body.reported.csr;
    if (csr) {
        client.log(csr)
    }
}
```

If I click a gutter icon for one of the requests further down in the file (below this one), if always executes the request where the cursor currently stands (no matter if the selected line is above or below the one with the script or the gutter.

 

0

Strange thing: It might not be caused by the referenced script. I just removed the referenced script and the error still persists. I can also confirm that the given file has no duplicate requests (each url is different) and there are also no duplicates in request names (indicated with the ###).

I now removed more and more requests from the production script so that I ended up with an exact copy of the sample I created before and the issue only appears in one of the files. I also validated that both use the same environment so that the issue cannot originate in some values coming from the env.

I even made sure to not have some additional comments or empty new lines between the requests.

Is there any way to debug if there is additional state (like the client.global) that differs between the two files?

0

After closing and reopening the original requests file, the error is gone.

After restoring the original file content (the longer production script) I noticed that one gutter icon was missing on that one request definition that contained the script reference. When I changed on character somewhere else in the file, it suddenly appeared.

0

Please sign in to leave a comment.