playwright-go icon indicating copy to clipboard operation
playwright-go copied to clipboard

[Bug]: response.ServerAddr() panics

Open yaron12n opened this issue 6 months ago • 0 comments

Description

Calling response.ServerAddr() causes a panic even though the response object is valid. This occurs when using playwright-go version v0.5001.0.

resp := page.Response()
// response is valid
addr := resp.ServerAddr() // <- panic occurs here

Stacktrace:

/usr/local/go/src/runtime/panic.go:792 +0x124
reflect.flag.mustBe(...)
	/usr/local/go/src/reflect/value.go:221
reflect.Value.MapKeys({0x0?, 0x0?, 0x2b74b10?})
	/usr/local/go/src/reflect/map_swiss.go:211 +0x208
github.com/playwright-community/playwright-go.remapValue({0x0?, 0x0?, 0x40068adcb8?}, {0x2188860?, 0x4005c83728?, 0x2188860?})
	/go/pkg/mod/github.com/playwright-community/[email protected]/helpers.go:161 +0x5c8
github.com/playwright-community/playwright-go.remapMapToStruct({0x0?, 0x0?}, {0x1cedb20?, 0x4005c83728?})
	/go/pkg/mod/github.com/playwright-community/[email protected]/helpers.go:174 +0x100
github.com/playwright-community/playwright-go.(*responseImpl).ServerAddr(0x4005992bb0?)
	/go/pkg/mod/github.com/playwright-community/[email protected]/response.go:140 +0x84

Additional context The issue seems to be caused by remapMapToStruct being called with nil input, leading to a reflection call on a nil map at helpers.go:161.

yaron12n avatar May 13 '25 06:05 yaron12n