Skip to content

Commit 115740e

Browse files
committed
fix: dart packages, other fixes
1 parent f1863ba commit 115740e

File tree

26 files changed

+795
-268
lines changed

26 files changed

+795
-268
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
![Запись экрана 2025-10-02 в 13 06 06](https://github.com/user-attachments/assets/43044ece-e6b4-4702-80bc-0584e844c042)
44

5+
Free tool for debugging HTTP and WebSocket which is MUCH BETTER than the built-in Flutter Netwrok Devtools.
56

6-
Simple universal proxy for debugging HTTP and WebSocket. Suitable for local development and test environments. Has web interface (opens in browser), desktop and CLI.
7+
Suitable for local development and test environments. Has web interface (opens in browser), desktop and CLI.
78

89
What it can do
910
- Intercept and view HTTP and WebSocket traffic
@@ -16,7 +17,10 @@ What it can do
1617
- WebSocket details: events/frames, pings/pongs, payload preview
1718
- HAR export
1819
- Artificial response delay (useful for simulating "slow networks")
19-
- Record/stop and record management
20+
- Record/stop and records management
21+
- HTML preview
22+
- Form Data (show files) For example Flutter devtools don't show at all
23+
2024
...
2125

2226
Quick start

dart_packages/dio_debugger/.dart_tool/package_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"languageVersion": "3.0"
9393
}
9494
],
95-
"generated": "2025-10-28T00:14:54.608055Z",
95+
"generated": "2025-10-28T22:02:27.461813Z",
9696
"generator": "pub",
9797
"generatorVersion": "3.7.2",
9898
"flutterRoot": "file:///Users/belief/dev/flutter",

dart_packages/dio_debugger/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 0.1.4
4+
- Fix: исключены артефакты двойного `?` и закодированного `%3F` в query при построении target URL.
5+
Теперь `ReverseProxyInterceptor` нормализует ключи (срезает ведущий `?`) и
6+
собирает query строку через `Uri.replace(query: ...)`, что предотвращает ошибки
7+
вида `??page=...` и `?%3Fpage=...` в редких кейсах.
8+
- Internal: безломные изменения, API не менялся.
9+
310
## 0.1.3
411
- Docs: Added "Part of network_debugger ecosystem" reference
512
- Docs: Added "Starting the Proxy" section with setup instructions

dart_packages/dio_debugger/lib/src/reverse_proxy_interceptor.dart

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,31 +111,39 @@ class ReverseProxyInterceptor extends Interceptor {
111111
}) {
112112
final qpAll = <String, List<String>>{};
113113
// из baseQuery (уже String -> String)
114-
baseQuery.forEach((k, v) => qpAll[k] = [v]);
114+
baseQuery.forEach((k, v) {
115+
final key = k.startsWith('?') ? k.substring(1) : k;
116+
qpAll[key] = [v];
117+
});
115118
// из overrideQuery (dynamic)
116119
overrideQuery.forEach((k, v) {
117120
if (v == null) return;
121+
final kk = k.toString();
122+
final key = kk.startsWith('?') ? kk.substring(1) : kk;
118123
if (v is Iterable) {
119124
final list = <String>[];
120125
for (final item in v) {
121126
if (item == null) continue;
122127
list.add(item.toString());
123128
}
124-
if (list.isNotEmpty) qpAll[k] = list;
129+
if (list.isNotEmpty) qpAll[key] = list;
125130
} else {
126-
qpAll[k] = [v.toString()];
131+
qpAll[key] = [v.toString()];
127132
}
128133
});
129134

130-
// Сборка query строки вручную
131-
final qp = <String>[];
135+
// Сборка query строки вручную, затем безопасно подставляем через Uri.replace
136+
final parts = <String>[];
132137
qpAll.forEach((k, values) {
133138
for (final v in values) {
134-
qp.add('${Uri.encodeQueryComponent(k)}=${Uri.encodeQueryComponent(v)}');
139+
parts.add(
140+
'${Uri.encodeQueryComponent(k)}=${Uri.encodeQueryComponent(v)}');
135141
}
136142
});
137-
final query = qp.isEmpty ? '' : '?${qp.join('&')}';
138-
return Uri.parse('$base$query');
143+
final q = parts.join('&');
144+
// Убираем возможный существующий query из base и подставляем новый
145+
final cleanBase = base.replace(query: null, queryParameters: null);
146+
return cleanBase.replace(query: q);
139147
}
140148

141149
bool _isAbsoluteHttpUrl(String value) {

dart_packages/dio_debugger/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dio_debugger
22
description: "Lightweight utility to attach a reverse/forward proxy to an existing Dio instance for local debugging."
3-
version: 0.1.3
3+
version: 0.1.4
44
repository: https://github.com/cherrypick-agency/flutter_network_debugger
55
homepage: https://github.com/cherrypick-agency/flutter_network_debugger
66
issue_tracker: https://github.com/cherrypick-agency/flutter_network_debugger/issues
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Extension Discovery Cache
2+
=========================
3+
4+
This folder is used by `package:extension_discovery` to cache lists of
5+
packages that contains extensions for other packages.
6+
7+
DO NOT USE THIS FOLDER
8+
----------------------
9+
10+
* Do not read (or rely) the contents of this folder.
11+
* Do write to this folder.
12+
13+
If you're interested in the lists of extensions stored in this folder use the
14+
API offered by package `extension_discovery` to get this information.
15+
16+
If this package doesn't work for your use-case, then don't try to read the
17+
contents of this folder. It may change, and will not remain stable.
18+
19+
Use package `extension_discovery`
20+
---------------------------------
21+
22+
If you want to access information from this folder.
23+
24+
Feel free to delete this folder
25+
-------------------------------
26+
27+
Files in this folder act as a cache, and the cache is discarded if the files
28+
are older than the modification time of `.dart_tool/package_config.json`.
29+
30+
Hence, it should never be necessary to clear this cache manually, if you find a
31+
need to do please file a bug.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":2,"entries":[{"package":"web_socket_channel_debugger","rootUri":"../","packageUri":"lib/"}]}
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import 'package:web_socket_channel/web_socket_channel.dart' as wsc;
2+
import 'package:web_socket_channel/io.dart' as io;
3+
4+
// В IO окружении пробрасываем headers (Authorization/Cookie/и т.д.)
5+
wsc.WebSocketChannel connectWS(Uri uri, {Map<String, dynamic>? headers}) {
6+
return io.IOWebSocketChannel.connect(uri, headers: headers);
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'package:web_socket_channel/web_socket_channel.dart' as wsc;
2+
3+
// В вебе/не-IO окружении headers не поддерживаются — просто игнорируем их
4+
wsc.WebSocketChannel connectWS(Uri uri, {Map<String, dynamic>? headers}) {
5+
return wsc.WebSocketChannel.connect(uri);
6+
}

0 commit comments

Comments
 (0)