servicex-sh / httpx

httpx - CLI to test HTTP/gRPC/RSocket/Kafka... services by HTTP DSL
https://servicex.sh
Apache License 2.0
132 stars 9 forks source link

Global variables not working #19

Open riccardocossu opened 1 year ago

riccardocossu commented 1 year ago

I have this problem on debian (I tried it on windows but it didn't start); I am using the -a flag, which I expect to work like the "Run all" button in Idea.

I use this pattern in my tests (this works in Idea): I first login, get a token, set it in client.global and use it for several later calls.

Authorization: Bearer {{authToken}}

I debugged the issue and it turns out that global it's not working. Calling this in the script, it prints "undefined":

`client.global.set("authToken",response.body.access_token);

client.log(client.global.get("authToken"));`

Edit: I further investigated the problem and it is definitely in the JS part; it seems that the global_variables.json is written only at startup, using global.set never writes it. I am using debian on WSL2

riccardocossu commented 1 year ago

never mind, Jetbrains released a CLI runner a couple of days ago. That's what I am gonna use

linux-china commented 1 year ago

@riccardocossu for integration test, and HTTP Client CLI is better. httpx is native image binary, and JS is executed by external Node(not rhino embedded) and hard to implement some features.