Skip to content

Commit

Permalink
feat: update server for testing GetCurrentURL function
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielFillol committed May 27, 2024
1 parent 76dc262 commit 7d29190
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions testserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func StartTestServer() *http.Server {
<html>
<head><title>Test Page</title></head>
<body>
<a href="/page2" id="linkToPage2">Go to Page 2</a>
<button id="exampleButton" onclick="showDynamicContent()">Click Me</button>
<form id="searchForm">
<input type="text" id="searchBar" />
Expand Down Expand Up @@ -64,6 +65,20 @@ func StartTestServer() *http.Server {
</html>
`))
})

mux.HandleFunc("/page2", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`
<!DOCTYPE html>
<html>
<head><title>Page 2</title></head>
<body>
<a href="/" id="linkToPage1">Go to Page 1</a>
<p>This is Page 2</p>
</body>
</html>
`))
})

server := &http.Server{Addr: ":8080", Handler: mux}
go server.ListenAndServe()
return server
Expand Down

0 comments on commit 7d29190

Please sign in to comment.