[RequestHook]: add methods for manipulation with response headers
See original GitHub issueResponseEvent.setHeader(name, value)
ResponseEvent.removeHeader(name)
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Add response headers via RequestHook - Stack Overflow
Currently, the only way to add the headers to the response is to use the private _onConfigureResponse method of the RequestHook class:
Read more >Request hook's onResponse method not being called #4070
But I want to manipulate the response headers of a request. So I set up a request hook: const { RequestHook } =...
Read more >RequestHook Class | Test API | API | Docs - TestCafe
To change response headers, use the event.setHeader and event.removeHeader methods in the __onConfigureResponse call. Important. The RequestHook.
Read more >Back to Basics: Custom HTTP Response Header Manipulation ...
NET Core doesn't have an obvious, built-in way to add headers to every request. In this back to basics post I describe what...
Read more >End-to-End Testing with TestCafe Book Excerpt: Intercepting ...
The fixture and test functions have a method called requestHooks where you can attach either an instance of RequestLogger or RequestMock .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, it’s more appropriate to mark the
onConfigureResponse
event as public and remove the default implementation from theRequestHook
base class. We will do it only before thetestcafe@1.0.0
was released, because it’s a breaking change. Now, let’s keep this method as is. So, the use of thesetHeader
andremoveHeader
methods will look like this:Having discussed this with the team, we can suggest the following API:
removeHeader(name)
setHeader(name, value)
These methods will be defined as methods of the ConfigureResponseEvent class.
The feature implementation can be divided into 2 parts:
split the header-transforms.js file into two parts:
header-transforms.js
- contains only transformations for request and response headersheader-transform-api.js
- contains theforRequest
,forResponse
andtransformHeadersCaseToRaw
methodschange response headers transformation order.