Update fetch for static page gen, fix DOM patching
This commit is contained in:
@@ -8,8 +8,17 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall/js"
|
||||
|
||||
"kjol/httputil"
|
||||
)
|
||||
|
||||
// Installing the transport here (rather than leaving it to each app's main)
|
||||
// keeps httputil's invariant true by construction: FetchGob / FetchJSON have a
|
||||
// transport exactly when they are running in the browser. That is what lets them
|
||||
// no-op during SSR instead of reporting a failure. Apps that need custom headers
|
||||
// or a base URL can wrap FetchBytes with httputil.SetClientTransport at startup.
|
||||
func init() { httputil.SetClientTransport(FetchBytes) }
|
||||
|
||||
// absURL resolves a relative path against the current origin (a browser resolves
|
||||
// relative fetch URLs itself, but building the absolute URL keeps behavior
|
||||
// uniform — and lets non-browser hosts, e.g. tests, fetch too).
|
||||
|
||||
Reference in New Issue
Block a user