-
Notifications
You must be signed in to change notification settings - Fork 34
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
Improve scripts #252
Merged
Merged
Improve scripts #252
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gorillamoe
force-pushed
the
feat/improve-scripts
branch
2 times, most recently
from
October 1, 2024 13:26
6e43903
to
32e842a
Compare
gorillamoe
force-pushed
the
feat/improve-scripts
branch
from
October 1, 2024 14:06
32e842a
to
3084754
Compare
Something like this is now easily possible:
// https://www.jetbrains.com/help/idea/http-response-reference.html#request-properties
const url = new URL(request.url.tryGetSubstituted());
const method = request.method;
const params = url.searchParams;
const unix_timestamp = Math.floor(Date.now() / 1000);
const token_raw = request.variables.get('TOKEN_RAW');
const key1 = params.get('key1');
const computed_token = `${method}${token_raw}${key1}${unix_timestamp}`;
// Either use request.variables.set which is only valid for the current request
// or use client.global.set("COMPUTED_TOKEN", computed_token) to store the value globally
// and persist it across restarts
request.variables.set('COMPUTED_TOKEN', computed_token);
const contentTypeHeader = request.headers.findByName('Content-Type');
if (contentTypeHeader) {
client.log("Content-Type:" + contentTypeHeader.getRawValue());
}
client.log({ url, method, params });
< {%
request.variables.set('TOKEN_RAW', 'THIS_IS_A_TOKEN');
%}
< ./../scripts/pre-token-gen.js
POST https://httpbin.org/post?key1=value1 HTTP/1.1
Accept: application/json
Content-Type: application/json
Token: {{COMPUTED_TOKEN}}
{
"foobar": "lul"
} |
gorillamoe
added a commit
to rcasia/kulala.nvim
that referenced
this pull request
Oct 7, 2024
* feat(scripts): make it work with most jetbrains stuff See: https://www.jetbrains.com/help/idea/http-response-reference.html#request-properties * chore(version): bump * feat(docs): request-reference * feat(scripts): even closer to jetbrains * fix(docs): linter
iamxiaojianzheng
pushed a commit
to iamxiaojianzheng/kulala.nvim
that referenced
this pull request
Oct 24, 2024
* feat(scripts): make it work with most jetbrains stuff See: https://www.jetbrains.com/help/idea/http-response-reference.html#request-properties * chore(version): bump * feat(docs): request-reference * feat(scripts): even closer to jetbrains * fix(docs): linter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.