-
Notifications
You must be signed in to change notification settings - Fork 162
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
[RequestHook]: add methods for manipulation with response headers #1657
Comments
Hi!, I was trying to implement this feature, but, before making changes (and get them rejected) i though that it would be better to discuss the implementation approach. First of all, what is the ideal interface?:
Regarding the request pipeline, the headers (and all the response) are sent before the In addition, i suppose that the [1] sendResponseHeaders, onResponse |
Hi @NickCis We planned this feature for internal purposes. |
Hi @miherlosev , thank you for the quick response. The use case is interacting with an external payment api that is used by adding an iframe to the web. The idea is to set headers in order to allow interaction with the iframe. |
Would you please clarify which headers you want to modify to allow interaction with the iframe? |
Yes, sorry for being too shynthetic. This 3rd party API sets the Another use case, that addresses this feature, is implementing a workaround for Facebook login. |
Thank you for the detailed explanation of your scenario. Before discussing a public API we need to perform an additional investigation. |
Having discussed this with the team, we can suggest the following API:
These methods will be defined as methods of the ConfigureResponseEvent class. The feature implementation can be divided into 2 parts:
|
@miherlosev I'll be working on that on PR #1790 |
The proposed implementation will allow to modify the headers in the The problem with this event is that, in testcafe, is private. The In addition of this PR, won't testcafe need one to make this api public?, ei: add a |
Yes, it's more appropriate to mark the class CustomRequestHook extends RequestHook {
_onConfigureResponse (event) {
super._onConfigureResponse(event);
event.setHeader('x-frame-options', 'allow-from https://example.com/');
event.removeHeader('x-header-name');
}
} |
…oses DevExpress#1657) (DevExpress#1790) * Splited header-transforms * ConfigureResponseEvent: `setHeader` & `removeHeader` * test/server/request-hook-test: Added ConfigureResponseEvent `removeHeader` & `setHeader` test * test/server/proxy-test: Added Response header modification test cafe * Renamed `header-transforms` files and exports * fixed test/server/proxy-test typo * request-pipeline: splitted `callResponseEventCallbackForProcessedRequest` in order to send `onResponse` on `ctx.res.end()` callback
This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow. |
https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/creating-a-custom-http-request-hook.html#the-onresponse-method
ResponseEvent.setHeader(name, value)
ResponseEvent.removeHeader(name)
The text was updated successfully, but these errors were encountered: