You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write a hook that (automatically) first tries an HTTPS version of a website, and then if it fails, retries it without forcing the HTTPS version.
This is currently not possible to do as a got plugin, as in the control flow of "beforeRequest forces HTTPS" -> "request fails" -> "beforeRetry sets a flag to not force HTTPS" -> "beforeRequest doesn't force HTTPS this time" -> "request sent", you cannot "send" information between the beforeRetry hook and the second invocation of beforeRequest hook, due to the beforeRetry hook not having options as a parameter, which is used everywhere else in got's ecosystem to pass around information between hooks.
(note that afterResponse doesn't cut it because the request may throw - not just return a 4xx/5xx - when requesting a https version of a website (e.g. the certs may throw).
Describe the feature
Please add a third parameter, options, to the beforeRetry hooks. That's it.
Checklist
I have read the documentation and made sure this feature doesn't already exist.
The text was updated successfully, but these errors were encountered:
What problem are you trying to solve?
I am trying to write a hook that (automatically) first tries an HTTPS version of a website, and then if it fails, retries it without forcing the HTTPS version.
This is currently not possible to do as a got plugin, as in the control flow of "beforeRequest forces HTTPS" -> "request fails" -> "beforeRetry sets a flag to not force HTTPS" -> "beforeRequest doesn't force HTTPS this time" -> "request sent", you cannot "send" information between the beforeRetry hook and the second invocation of beforeRequest hook, due to the beforeRetry hook not having
options
as a parameter, which is used everywhere else in got's ecosystem to pass around information between hooks.(note that afterResponse doesn't cut it because the request may throw - not just return a 4xx/5xx - when requesting a https version of a website (e.g. the certs may throw).
Describe the feature
Please add a third parameter,
options
, to the beforeRetry hooks. That's it.Checklist
The text was updated successfully, but these errors were encountered: