@@ -94,17 +94,7 @@ export function initial_fetch(resource, opts) {
94
94
return Promise . resolve ( new Response ( body , init ) ) ;
95
95
}
96
96
97
- const patched_opts = { ...opts } ;
98
- if ( DEV ) {
99
- // This assigns the __sveltekit_fetch__ flag and makes it non-enumerable
100
- Object . defineProperty ( patched_opts , '__sveltekit_fetch__' , {
101
- value : true ,
102
- writable : true ,
103
- configurable : true
104
- } ) ;
105
- }
106
-
107
- return window . fetch ( resource , patched_opts ) ;
97
+ return DEV ? dev_fetch ( resource , opts ) : window . fetch ( resource , opts ) ;
108
98
}
109
99
110
100
/**
@@ -130,17 +120,22 @@ export function subsequent_fetch(resource, resolved, opts) {
130
120
}
131
121
}
132
122
133
- const patched_opts = { ...opts } ;
134
- if ( DEV ) {
135
- // This assigns the __sveltekit_fetch__ flag and makes it non-enumerable
136
- Object . defineProperty ( patched_opts , '__sveltekit_fetch__' , {
137
- value : true ,
138
- writable : true ,
139
- configurable : true
140
- } ) ;
141
- }
123
+ return DEV ? dev_fetch ( resolved , opts ) : window . fetch ( resolved , opts ) ;
124
+ }
142
125
143
- return window . fetch ( resolved , patched_opts ) ;
126
+ /**
127
+ * @param {RequestInfo | URL } resource
128
+ * @param {RequestInit & Record<string, any> | undefined } opts
129
+ */
130
+ function dev_fetch ( resource , opts ) {
131
+ const patched_opts = { ...opts } ;
132
+ // This assigns the __sveltekit_fetch__ flag and makes it non-enumerable
133
+ Object . defineProperty ( patched_opts , '__sveltekit_fetch__' , {
134
+ value : true ,
135
+ writable : true ,
136
+ configurable : true
137
+ } ) ;
138
+ return window . fetch ( resource , patched_opts ) ;
144
139
}
145
140
146
141
/**
0 commit comments