mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-03-19 05:19:47 +08:00
fix import har
This commit is contained in:
@@ -342,7 +342,11 @@ class HttpStatus {
|
||||
/// 504 Gateway Timeout
|
||||
static final HttpStatus gatewayTimeout = newStatus(504, "Gateway Timeout");
|
||||
|
||||
static HttpStatus newStatus(int statusCode, String reasonPhrase) {
|
||||
static HttpStatus newStatus(int statusCode, String? reasonPhrase) {
|
||||
if (reasonPhrase == null) {
|
||||
return HttpStatus.valueOf(statusCode);
|
||||
}
|
||||
|
||||
return HttpStatus(statusCode, reasonPhrase);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,9 +163,9 @@ class HistoryStorage {
|
||||
var json = jsonDecode(readAsBytes);
|
||||
var log = json['log'];
|
||||
String name = formatDate(DateTime.now(), [mm, '-', d, ' ', HH, ':', nn, ':', ss]);
|
||||
List? pages = log['pages'] as List;
|
||||
if (pages.isNotEmpty) {
|
||||
name = pages.first['title'];
|
||||
List? pages = log['pages'] as List?;
|
||||
if (pages?.isNotEmpty == true) {
|
||||
name = pages?.first['title'];
|
||||
}
|
||||
|
||||
//解析请求
|
||||
|
||||
@@ -136,7 +136,7 @@ class Har {
|
||||
List headers = request['headers'];
|
||||
|
||||
var httpRequest = HttpRequest(HttpMethod.valueOf(method), request['url'], protocolVersion: request['httpVersion']);
|
||||
if (har.containsKey("_id")) httpRequest.requestId = har['_id']; // 页面标识
|
||||
if (har.containsKey("_id")) httpRequest.requestId = har['_id'].toString(); // 页面标识
|
||||
httpRequest.processInfo = har['_app'] == null ? null : ProcessInfo.fromJson(har['_app']);
|
||||
httpRequest.body = request['postData']?['text']?.toString().codeUnits;
|
||||
for (var element in headers) {
|
||||
|
||||
Reference in New Issue
Block a user