mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-14 05:14:28 -08:00
29 lines
570 B
HTML
29 lines
570 B
HTML
|
|
<script type='module'>
|
||
|
|
|
||
|
|
const original = globalThis.fetch
|
||
|
|
globalThis.fetch = function(...args) {
|
||
|
|
console.log('fetch called')
|
||
|
|
return original.apply(null, args)
|
||
|
|
}
|
||
|
|
|
||
|
|
for(let key of [
|
||
|
|
'arrayBuffer',
|
||
|
|
'blob',
|
||
|
|
'formData',
|
||
|
|
'json',
|
||
|
|
'text',
|
||
|
|
]) {
|
||
|
|
|
||
|
|
let original = Response.prototype[key]
|
||
|
|
Response.prototype[key] = function(...args){
|
||
|
|
console.log('key called', key)
|
||
|
|
return original.apply(this, args)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
console.log((await (await fetch('/')).text()).length)
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
</script>
|