mirror of
https://github.com/liriliri/eruda.git
synced 2026-03-20 09:38:37 +08:00
Dev: Catch xhr sent data
This commit is contained in:
@@ -64,12 +64,12 @@ export default class Network extends Tool
|
||||
origOpen.apply(this, arguments);
|
||||
};
|
||||
|
||||
winXhrProto.send = function (...args)
|
||||
winXhrProto.send = function (data)
|
||||
{
|
||||
var req = this.erudaRequest;
|
||||
if (req) req.handleSend();
|
||||
if (req) req.handleSend(data);
|
||||
|
||||
origSend.apply(this, args);
|
||||
origSend.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
restoreXhr()
|
||||
@@ -93,6 +93,7 @@ export default class Network extends Tool
|
||||
type: 'unknown',
|
||||
subType: 'unknown',
|
||||
size: 0,
|
||||
data: '',
|
||||
method: 'GET',
|
||||
startTime: util.now(),
|
||||
time: 0,
|
||||
@@ -138,6 +139,7 @@ export default class Network extends Tool
|
||||
|
||||
showSources('http', {
|
||||
url: data.url,
|
||||
data: data.data,
|
||||
resTxt: data.resTxt,
|
||||
type: data.type,
|
||||
subType: data.subType,
|
||||
|
||||
@@ -11,11 +11,14 @@ export default class Request extends util.Emitter
|
||||
this._url = url;
|
||||
this._id = util.uniqId('request');
|
||||
}
|
||||
handleSend()
|
||||
handleSend(data)
|
||||
{
|
||||
if (!util.isStr(data)) data = '';
|
||||
|
||||
this.emit('send', this._id, {
|
||||
name: util.getFileName(this._url),
|
||||
url: this._url,
|
||||
data: data,
|
||||
method: this._method,
|
||||
xhr: this._xhr
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.response {
|
||||
.response, .data {
|
||||
background: #fff;
|
||||
padding: $common-padding;
|
||||
margin-bottom: 10px;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<div class="eruda-http">
|
||||
<div class="eruda-breadcrumb">{{url}}</div>
|
||||
{{#if data}}
|
||||
<pre class="eruda-data">{{data}}</pre>
|
||||
{{/if}}
|
||||
<div class="eruda-section">
|
||||
<h2>Response Headers</h2>
|
||||
<table class="eruda-headers">
|
||||
|
||||
Reference in New Issue
Block a user