-
Notifications
You must be signed in to change notification settings - Fork 659
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
Allow to change URL using requestOptions.url in RequestHooks #2635
Comments
any leads for fixing this issue? I'd be interested in picking this up if you think this is easy enough to understand -- I'm new to the testcafe codebase |
Hi @kennychua Thank you for your interest in TestCafe. At present, we don't have a final API design for this enhancement. We will discuss about it and let you know about results. |
We faced the same issue. After struggling a couple of hours try to find why this didn't work, I found a reference to this issue. |
This feature is implemented. import { RequestHook } from 'testcafe';
class CustomRequestHook extends RequestHook {
onRequest (e) {
e.requestOptions.path = '/another-page';
}
} |
Do you know how many hours I spent today trying to figure out why changing the url in requestOptions wasn't working? Almost as many as I spent yesterday trying to figure out why modifying the headers in onResponse didn't work. At least there's a README somewhere that mentions that that won't work, even though it's not in the jsdoc on the actual method where I might have seen it. I was on the verge of concluding that the line in the docs about being able to use |
Hi @pjweisberg, We apologize for this misunderstanding. We will update information about how to change a URL in the documentation. |
Are you requesting a feature or reporting a bug?
Enhancement
What is the current behavior?
The destination URL of a request can be changed in a RequestHook by modifying parts like
hostname
,port
,protocol
of the URL by altering corresponding properties of arequestOptions
object. TherequestOptions.url
property can be changed, but it doesn't lead to change of the request's destination.What is the expected behavior?
The destination of a request must be changed when the
requestOptions.url
is changed.The text was updated successfully, but these errors were encountered: