Let me explain a bit of back story.I wanted to change the referer(dynamically) for a webview so I quicky defaulted to the QWebEngineUrlRequestInterceptor. (to basically intercept requests and do the necessary appending of a header).It needed an info to be passed QWebEngineUrlRequestInfo .But i noticed the info didn't have a constructor to I resulted in creating a subclass of the interceptor and have it append headers and intercept request by overriding the interceptrequest function see the code below and a similar implementation here
But the issue comes in apending the "Referer" header.It simply does not work.All other headers I tested simply work.I am guessing the
function simply overrides the any referer and simply implements what it deems right(the default referer)
So that's when I gave up on this option(method) and decide to use a QWebEngineHttpRequest which i recently so as an addition to QT 5.9 which basically is a request that you pass into the webview->load(); function.Sounds easy enough....cough cough
Here is my implementation.
The above does not work which is quite frustrating.The referer is not set yet the foo header is set to the value referer(byteData)
but this works .
So the ACTUAL BUG comes down to passing QByteArray to the setHeader method when the header name is "Referer".
In addition to solving the bug,I would like to ask if the is away to change referer that works. Even ifs too dirty.