From 6761441060f6d901c097115cc2255d97737e97b8 Mon Sep 17 00:00:00 2001 From: Alexandra Fishova Date: Sat, 21 Sep 2024 19:34:32 +0300 Subject: [PATCH] Use web page address when making request to reload proxy (#625) * Use web page address when making request to reload proxy Signed-off-by: Alexandra Fishova * Create event source with just a path because browser can handle address on its own. Signed-off-by: Alexandra Fishova --------- Signed-off-by: Alexandra Fishova --- runner/proxy.go | 5 +---- runner/proxy_test.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/runner/proxy.go b/runner/proxy.go index 70614475..6bf3059e 100644 --- a/runner/proxy.go +++ b/runner/proxy.go @@ -66,10 +66,7 @@ func (p *Proxy) injectLiveReload(resp *http.Response) (string, error) { return page, nil } - script := fmt.Sprintf( - ``, - p.config.ProxyPort, - ) + script := `` return page[:body] + script + page[body:], nil } diff --git a/runner/proxy_test.go b/runner/proxy_test.go index a14ec3d6..73e5b05c 100644 --- a/runner/proxy_test.go +++ b/runner/proxy_test.go @@ -190,7 +190,7 @@ func TestProxy_injectLiveReload(t *testing.T) { }, Body: io.NopCloser(strings.NewReader(`

test

`)), }, - expect: `

test

`, + expect: `

test

`, }, } for _, tt := range tests {