-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
Missing header in hijack request #185
Comments
Currently, we can use this event to get it: page.EachEvent(func(e *proto.NetworkRequestWillBeSentExtraInfo) {
fmt.Println(e)
})() |
After trying test code like this:
func (s *S) TestHijackContinue() {
url, engine, close := serve()
defer close()
// to simulate a backend server
engine.GET("/", ginHTML(`<html>
<body></body>
<script>
fetch('/a', { headers: { 'My-Header': 'test' } }).then(async (res) => {
document.body.innerText = await res.text()
})
</script></html>`))
engine.GET("/a", ginString(`ok`))
router := s.page.HijackRequests()
defer router.MustStop()
router.MustAdd(url+"/a", func(ctx *rod.Hijack) {
kit.Pause()
})
go router.Run()
s.page.MustSetExtraHeaders("test", "b")
s.page.MustNavigate(url)
kit.Pause()
} I found it's impossible to get the RequestWillBeSentExtraInfo for a paused request. Unless chrome adds new APIs to support it, we can't do much about it. |
I raised an issue for chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=1122782 Related issue: puppeteer/puppeteer#5364 (comment) |
When I hijack, the request missing these headers: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Dest
The text was updated successfully, but these errors were encountered: