-
Notifications
You must be signed in to change notification settings - Fork 38
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
Setting oauth2_interceptRequest
if not already defined
#812
Comments
Not quite. A change in an *.http file causes the variables for this file to be discarded. Changes in Javascript files with the name httpyac also discard the variables (code). External scripts imported with require would not discard the variables.
exports is empty, but all variables are added to the context. The context can be also accessed using this. You can test if the variable is not defined using e.g. testVars not defined on first request and will not be replaced. On second request the variable will use value
|
Thanks for the quick clarifications! It seems I can't get rid of the extra requests. I'll try to write an example that does not depend on our internal systems and will update this issue-- or maybe I'll open another issue, as the source of the extra requests seems not to be the assignment to the oauth2_* variables. By the way, should I propose a documentation update MR on how to disable SSL verification? |
For me it was just the way to do it either via Environment or via Metadata. This is documented. Using property noRejectUnauthorized on request in scripting also works and is also documented (but more hidden, you need to click a link): https://httpyac.github.io/guide/scripting.html#access-to-variables Using request.options is more or less not desired to use. This is a special feature from got/ http request and will not change behaviour of e.g wegsocket requests. |
I have a
common.http
file that I import before every request. The script in this file sets theoauth2_interceptRequest
to disable SSL verification:Unfortunately, it seems that assigning to the
oauth2_*
variables invalides any access token obtained for the oauth2 prefix, and thus a new access token is retrieved for every request.Note that I implement a OAuth2 Password Grant type returning an access token with a lifetime in hours, and there is no refresh token. Accordingly
oauth2_keepAlive
is not set.Of course
exports
is empty when thecommon.http
file is run, so I can't test that. Wrapping the above code inif (typeof oauth2_interceptRequest === undefined)
does not seem to work.What can I do?
The text was updated successfully, but these errors were encountered: