@@ -63,9 +63,11 @@ class FetchResponse {
6363 if ( this . isScript ) {
6464 const script = document . createElement ( "script" ) ;
6565 const metaTag = document . querySelector ( "meta[name=csp-nonce]" ) ;
66- const nonce = metaTag && metaTag . content ;
67- if ( nonce ) {
68- script . setAttribute ( "nonce" , nonce ) ;
66+ if ( metaTag ) {
67+ const nonce = metaTag . nonce === "" ? metaTag . content : metaTag . nonce ;
68+ if ( nonce ) {
69+ script . setAttribute ( "nonce" , nonce ) ;
70+ }
6971 }
7072 script . innerHTML = await this . text ;
7173 document . body . appendChild ( script ) ;
@@ -166,7 +168,7 @@ class FetchRequest {
166168 this . options . headers = headers ;
167169 }
168170 sameHostname ( ) {
169- if ( ! this . originalUrl . startsWith ( "http:" ) ) {
171+ if ( ! this . originalUrl . startsWith ( "http:" ) && ! this . originalUrl . startsWith ( "https:" ) ) {
170172 return true ;
171173 }
172174 try {
@@ -182,7 +184,8 @@ class FetchRequest {
182184 body : this . formattedBody ,
183185 signal : this . signal ,
184186 credentials : this . credentials ,
185- redirect : this . redirect
187+ redirect : this . redirect ,
188+ keepalive : this . keepalive
186189 } ;
187190 }
188191 get headers ( ) {
@@ -260,6 +263,9 @@ class FetchRequest {
260263 get credentials ( ) {
261264 return this . options . credentials || "same-origin" ;
262265 }
266+ get keepalive ( ) {
267+ return this . options . keepalive || false ;
268+ }
263269 get additionalHeaders ( ) {
264270 return this . options . headers || { } ;
265271 }
0 commit comments