reqwise-react 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/README.md +552 -66
- package/package.json +7 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> reqwise-react@1.
|
|
2
|
+
> reqwise-react@1.2.0 build C:\Users\PC\Desktop\Code\reqwise\packages\react
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mCJS[39m Build start
|
|
12
12
|
[34mESM[39m Build start
|
|
13
|
+
[32mCJS[39m [1mdist\index.js [22m[32m4.92 KB[39m
|
|
14
|
+
[32mCJS[39m [1mdist\index.js.map [22m[32m5.62 KB[39m
|
|
15
|
+
[32mCJS[39m ⚡️ Build success in 10ms
|
|
13
16
|
[32mESM[39m [1mdist\index.mjs [22m[32m2.96 KB[39m
|
|
14
17
|
[32mESM[39m [1mdist\index.mjs.map [22m[32m5.45 KB[39m
|
|
15
18
|
[32mESM[39m ⚡️ Build success in 11ms
|
|
16
|
-
[32mCJS[39m [1mdist\index.js [22m[32m4.92 KB[39m
|
|
17
|
-
[32mCJS[39m [1mdist\index.js.map [22m[32m5.62 KB[39m
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in 11ms
|
package/README.md
CHANGED
|
@@ -1,17 +1,91 @@
|
|
|
1
|
-
# Reqwise React
|
|
1
|
+
# Reqwise React 🚀
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **Reqwise** is a powerful, production-ready React component that captures, logs, and visualizes HTTP API requests (Axios/Fetch) within React applications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It operates like a mini **Postman** or **Chrome DevTools Network** panel embedded directly inside your React app. Through a floating aside panel, developers can inspect requests in real-time, browse page history, analyze API endpoints, and send manual test requests with a single click.
|
|
6
|
+
|
|
7
|
+
**Version:** 1.2.0 | **Status:** Production Ready | **React:** 17+
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## ✨ Core Features
|
|
12
|
+
|
|
13
|
+
### 🔄 HTTP Interception & Logging
|
|
14
|
+
- **Full HTTP Capture:** Automatically logs all request/response payloads (method, URL, headers, body, status, duration)
|
|
15
|
+
- **Axios & Fetch Support:** Works seamlessly with Axios interceptors or native fetch API
|
|
16
|
+
- **Request Timing:** Precise measurement of round-trip duration for performance analysis
|
|
17
|
+
- **Error Tracking:** Captures network errors, timeouts, and HTTP error responses with stack traces
|
|
18
|
+
|
|
19
|
+
### 💾 Smart Persistence
|
|
20
|
+
- **localStorage Integration:** Stores all request history under `reqwise_history_v1` key
|
|
21
|
+
- **In-Memory Mode:** Optional in-memory storage without localStorage pollution (for restricted environments)
|
|
22
|
+
- **Auto-Cleanup:** Configurable `maxItems` limit with oldest-first eviction strategy
|
|
23
|
+
- **TTL Support:** Automatic deletion of entries older than configurable `historyTTL` (in days)
|
|
24
|
+
|
|
25
|
+
### 🛡️ Security & Privacy
|
|
26
|
+
- **Header Masking:** Redact sensitive headers like `Authorization`, `Cookie`, `X-API-Key`
|
|
27
|
+
- **Field Masking:** Obfuscate nested JSON fields like `password`, `token`, `ssn`, `cvv`
|
|
28
|
+
- **Smart Ignore Patterns:** Skip unwanted URLs with regex/substring matching
|
|
29
|
+
- **No Data Transmission:** All data stays local; no external calls made
|
|
30
|
+
|
|
31
|
+
### 🌍 Internationalization (i18n)
|
|
32
|
+
- **15 Languages Built-in:** English, Turkish, Azerbaijani, Russian, German, French, Spanish, Portuguese, Chinese, Japanese, Arabic, Korean, Italian, Polish, Dutch
|
|
33
|
+
- **Runtime Switching:** Language selector in the panel
|
|
34
|
+
- **Smart Detection:** Auto-detects browser language
|
|
35
|
+
|
|
36
|
+
### ⌨️ Keyboard & Hotkey Support
|
|
37
|
+
- **Customizable Hotkeys:** Toggle panel with keyboard shortcut (default: `ctrl+shift+e`)
|
|
38
|
+
- **Cross-platform:** Works on Windows, Mac, Linux
|
|
39
|
+
|
|
40
|
+
### 🎨 UI & UX Enhancements
|
|
41
|
+
- **4 Tabbed Interface:**
|
|
42
|
+
- **Current Tab:** Requests from current page
|
|
43
|
+
- **History Tab:** All captured requests with filtering (method, status, page, source)
|
|
44
|
+
- **Send Tab:** Mini HTTP client — compose and send test requests
|
|
45
|
+
- **Endpoints Tab:** Auto-discovered API endpoints with statistics (hit count, methods, params, examples)
|
|
46
|
+
- **Placement Flexibility:** 4 positions (top, right, bottom, left) — sidebars or drawers
|
|
47
|
+
- **Theme Support:** Dark, Light, and System (prefers-color-scheme) themes
|
|
48
|
+
- **Responsive Sizing:** 4 size presets (sm: 320px, md: 420px, lg: 560px, full: 100%)
|
|
49
|
+
- **Opacity Control:** Semi-transparent panels with configurable opacity (0.0–1.0) and backdrop blur
|
|
50
|
+
- **Request Cards:** Compact view (method + URL + status + duration) or detailed view with collapsible sections
|
|
51
|
+
|
|
52
|
+
### 🔍 Filtering & Search
|
|
53
|
+
- **Method Filter:** GET, POST, PUT, PATCH, DELETE
|
|
54
|
+
- **Status Filter:** All, Success (2xx), Client Errors (4xx), Server Errors (5xx)
|
|
55
|
+
- **Page Filter:** View requests by page (useful in SPAs)
|
|
56
|
+
- **Source Filter:** Auto-captured vs. manual (Send tab) requests
|
|
57
|
+
- **URL Search:** Text filter by URL patterns
|
|
58
|
+
|
|
59
|
+
### 📊 Endpoint Intelligence
|
|
60
|
+
- **Auto-Discovery:** Learns all API endpoints from captured requests
|
|
61
|
+
- **Statistics:** Per-endpoint hit count, HTTP methods, parameter types
|
|
62
|
+
- **Example Collection:** Stores real-world parameter examples
|
|
63
|
+
|
|
64
|
+
### 📤 Advanced Features
|
|
65
|
+
- **Callback Hooks:**
|
|
66
|
+
- `onRequest(entry)` — fires when request starts
|
|
67
|
+
- `onResponse(entry)` — fires on successful response
|
|
68
|
+
- `onError(entry)` — fires on HTTP error
|
|
69
|
+
- **Request Grouping:** Group by URL, method, status, or page
|
|
70
|
+
- **Highlight Mode:** Highlight error or slow requests
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 📦 Installation
|
|
6
75
|
|
|
7
76
|
```bash
|
|
8
|
-
npm install reqwise-react
|
|
77
|
+
npm install reqwise-react axios
|
|
9
78
|
# or
|
|
10
|
-
pnpm add reqwise-react
|
|
79
|
+
pnpm add reqwise-react axios
|
|
11
80
|
```
|
|
12
81
|
|
|
13
|
-
|
|
82
|
+
**Note:** Axios is optional but recommended for auto-capture. You can use Reqwise without it via manual recording.
|
|
83
|
+
|
|
84
|
+
---
|
|
14
85
|
|
|
86
|
+
## 🚀 Quick Start
|
|
87
|
+
|
|
88
|
+
### Basic Setup
|
|
15
89
|
```jsx
|
|
16
90
|
import { ReqwiseDevTools } from 'reqwise-react'
|
|
17
91
|
import axios from 'axios'
|
|
@@ -23,106 +97,518 @@ export default function App() {
|
|
|
23
97
|
|
|
24
98
|
return (
|
|
25
99
|
<>
|
|
26
|
-
<ReqwiseDevTools
|
|
27
|
-
|
|
28
|
-
placement="right"
|
|
29
|
-
defaultOpen={false}
|
|
30
|
-
theme="dark"
|
|
31
|
-
/>
|
|
32
|
-
{/* Your app content */}
|
|
100
|
+
<ReqwiseDevTools axiosInstance={api} />
|
|
101
|
+
{/* Your app */}
|
|
33
102
|
</>
|
|
34
103
|
)
|
|
35
104
|
}
|
|
36
105
|
```
|
|
37
106
|
|
|
38
|
-
|
|
107
|
+
### Production Configuration
|
|
108
|
+
```jsx
|
|
109
|
+
import { ReqwiseDevTools } from 'reqwise-react'
|
|
110
|
+
import axios from 'axios'
|
|
111
|
+
|
|
112
|
+
const api = axios.create({
|
|
113
|
+
baseURL: 'https://api.example.com',
|
|
114
|
+
timeout: 5000,
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
export default function App() {
|
|
118
|
+
return (
|
|
119
|
+
<ReqwiseDevTools
|
|
120
|
+
axiosInstance={api}
|
|
121
|
+
enabled={process.env.NODE_ENV === 'development'}
|
|
122
|
+
placement="right"
|
|
123
|
+
theme="dark"
|
|
124
|
+
show="detailed"
|
|
125
|
+
size="lg"
|
|
126
|
+
defaultOpen={false}
|
|
127
|
+
maxItems={500}
|
|
128
|
+
persistHistory={true}
|
|
129
|
+
hotkey="ctrl+shift+e"
|
|
130
|
+
langs={['en', 'tr']}
|
|
131
|
+
defaultLang="en"
|
|
132
|
+
ignore={['/health', '/ping']}
|
|
133
|
+
maskHeaders={['Authorization', 'X-API-Key']}
|
|
134
|
+
maskFields={['password', 'token', 'secret']}
|
|
135
|
+
groupBy="url"
|
|
136
|
+
highlight="error"
|
|
137
|
+
onRequest={(e) => console.log('Request:', e.method, e.url)}
|
|
138
|
+
onResponse={(e) => console.log('Response:', e.status, e.duration)}
|
|
139
|
+
onError={(e) => console.error('Error:', e.status, e.url)}
|
|
140
|
+
/>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Props API
|
|
39
148
|
|
|
40
149
|
### Core Configuration
|
|
41
150
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
151
|
+
| Prop | Type | Default | Description |
|
|
152
|
+
|------|------|---------|-------------|
|
|
153
|
+
| `axiosInstance` | AxiosInstance | - | Axios instance to monitor (required for auto-capture) |
|
|
154
|
+
| `enabled` | boolean | true | Enable/disable panel |
|
|
155
|
+
| `placement` | 'left' \| 'right' \| 'top' \| 'bottom' | 'right' | Panel position |
|
|
156
|
+
| `defaultOpen` | boolean | false | Open on mount |
|
|
157
|
+
| `theme` | 'dark' \| 'light' \| 'system' | 'system' | Color theme |
|
|
158
|
+
| `hotkey` | string | 'ctrl+shift+e' | Keyboard shortcut to toggle |
|
|
48
159
|
|
|
49
160
|
### Display Options
|
|
50
161
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
162
|
+
| Prop | Type | Default | Description |
|
|
163
|
+
|------|------|---------|-------------|
|
|
164
|
+
| `show` | 'general' \| 'detailed' | 'general' | Request card detail level |
|
|
165
|
+
| `size` | 'sm' \| 'md' \| 'lg' \| 'full' | 'md' | Panel size |
|
|
166
|
+
| `opacity` | number | 1 | Panel opacity (0-1) |
|
|
54
167
|
|
|
55
168
|
### Data Management
|
|
56
169
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
170
|
+
| Prop | Type | Default | Description |
|
|
171
|
+
|------|------|---------|-------------|
|
|
172
|
+
| `maxItems` | number | 500 | Max requests to store |
|
|
173
|
+
| `persistHistory` | boolean | true | Save to localStorage |
|
|
174
|
+
| `ignore` | string[] | [] | URL patterns to ignore |
|
|
175
|
+
| `maskHeaders` | string[] | [] | Headers to mask |
|
|
176
|
+
| `maskFields` | string[] | [] | JSON fields to mask |
|
|
62
177
|
|
|
63
178
|
### Grouping & Highlighting
|
|
64
179
|
|
|
65
|
-
|
|
66
|
-
|
|
180
|
+
| Prop | Type | Default | Description |
|
|
181
|
+
|------|------|---------|-------------|
|
|
182
|
+
| `groupBy` | 'url' \| 'method' \| 'status' \| 'page' | - | Group requests by |
|
|
183
|
+
| `highlight` | 'error' \| 'slow' | 'error' | Highlight type |
|
|
67
184
|
|
|
68
185
|
### Localization
|
|
69
186
|
|
|
70
|
-
|
|
71
|
-
|
|
187
|
+
| Prop | Type | Default | Description |
|
|
188
|
+
|------|------|---------|-------------|
|
|
189
|
+
| `langs` | string[] | ['en'] | Supported languages |
|
|
190
|
+
| `defaultLang` | string | 'en' | Initial language |
|
|
72
191
|
|
|
73
192
|
### Callbacks
|
|
74
193
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
194
|
+
| Prop | Type | Description |
|
|
195
|
+
|------|------|-------------|
|
|
196
|
+
| `onRequest` | (entry) => void | Called when request starts |
|
|
197
|
+
| `onResponse` | (entry) => void | Called on successful response |
|
|
198
|
+
| `onError` | (entry) => void | Called on HTTP error |
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## 🚀 Architecture Flow
|
|
203
|
+
|
|
204
|
+
Reqwise acts as a transparent interceptor layer:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
React Application
|
|
208
|
+
↓
|
|
209
|
+
ReqwiseDevTools Component (mounts Reqwise)
|
|
210
|
+
↓
|
|
211
|
+
[Capture request metadata via Axios interceptor]
|
|
212
|
+
↓
|
|
213
|
+
axios.post(...)
|
|
214
|
+
↓
|
|
215
|
+
Backend API
|
|
216
|
+
↓
|
|
217
|
+
Response received
|
|
218
|
+
↓
|
|
219
|
+
[Record response, status, duration]
|
|
220
|
+
↓
|
|
221
|
+
[Dispatch reqwise:update event]
|
|
222
|
+
↓
|
|
223
|
+
[Panel re-renders with new entry]
|
|
224
|
+
↓
|
|
225
|
+
[Save to localStorage]
|
|
226
|
+
↓
|
|
227
|
+
Application receives response
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Data Lifecycle
|
|
231
|
+
1. **Request Started** → captured metadata (method, URL, headers, body)
|
|
232
|
+
2. **HTTP Executed** → Axios sends actual request
|
|
233
|
+
3. **Response Received** → status, headers, body captured
|
|
234
|
+
4. **Callbacks Fired** → `onRequest` → storage → `onResponse/onError`
|
|
235
|
+
5. **UI Updated** → panel detects new entry via custom event
|
|
236
|
+
6. **Persistence** → `localStorage.setItem('reqwise_history_v1', ...)`
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 💻 TypeScript Data Models
|
|
241
|
+
|
|
242
|
+
### ReqwiseEntry
|
|
243
|
+
```typescript
|
|
244
|
+
interface ReqwiseEntry {
|
|
245
|
+
id: string // Unique ID (auto-generated)
|
|
246
|
+
source: "auto" | "manual" // auto: captured, manual: Send tab
|
|
247
|
+
page: string // window.location.href at capture time
|
|
248
|
+
timestamp: string // ISO 8601 timestamp
|
|
249
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"
|
|
250
|
+
url: string // Full URL or relative path
|
|
251
|
+
params?: Record<string, unknown> // Query parameters
|
|
252
|
+
requestHeaders?: Record<string, string>
|
|
253
|
+
requestBody?: unknown // JSON or FormData
|
|
254
|
+
status?: number // HTTP status (200, 404, 500, etc.)
|
|
255
|
+
statusText?: string // Status text ("OK", "Not Found", etc.)
|
|
256
|
+
responseHeaders?: Record<string, string>
|
|
257
|
+
responseBody?: unknown // Response JSON/text
|
|
258
|
+
duration?: number // Round-trip time in milliseconds
|
|
259
|
+
error?: { message: string; stack?: string }
|
|
260
|
+
}
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### ReqwiseConfig
|
|
264
|
+
```typescript
|
|
265
|
+
interface ReqwiseConfig {
|
|
266
|
+
// UI & Display
|
|
267
|
+
theme?: "light" | "dark" | "system" // default: "system"
|
|
268
|
+
placement?: "top" | "right" | "bottom" | "left" // default: "right"
|
|
269
|
+
defaultOpen?: boolean // default: false
|
|
270
|
+
show?: "general" | "detailed" // default: "general"
|
|
271
|
+
size?: "sm" | "md" | "lg" | "full" // default: "md"
|
|
272
|
+
opacity?: number // 0.0-1.0, default: 1.0
|
|
273
|
+
|
|
274
|
+
// Control
|
|
275
|
+
enabled?: boolean // default: true
|
|
276
|
+
hotkey?: string // default: "ctrl+shift+e"
|
|
277
|
+
axiosInstance?: unknown // Axios instance to monitor
|
|
278
|
+
|
|
279
|
+
// Storage
|
|
280
|
+
persistHistory?: boolean // default: true
|
|
281
|
+
maxItems?: number // default: 200
|
|
282
|
+
historyTTL?: number // TTL in days, default: undefined (no expiry)
|
|
283
|
+
|
|
284
|
+
// Filtering
|
|
285
|
+
ignore?: string[] // default: []
|
|
286
|
+
maskHeaders?: string[] // default: []
|
|
287
|
+
maskFields?: string[] // default: []
|
|
288
|
+
|
|
289
|
+
// i18n
|
|
290
|
+
langs?: SupportedLang[] // default: ["en"]
|
|
291
|
+
defaultLang?: SupportedLang // Auto-detected from browser
|
|
292
|
+
|
|
293
|
+
// Callbacks
|
|
294
|
+
onRequest?: (entry: Partial<ReqwiseEntry>) => void
|
|
295
|
+
onResponse?: (entry: ReqwiseEntry) => void
|
|
296
|
+
onError?: (entry: ReqwiseEntry) => void
|
|
297
|
+
|
|
298
|
+
// UX
|
|
299
|
+
groupBy?: "url" | "method" | "status" | "page"
|
|
300
|
+
highlight?: "error" | "slow" | "none" // default: "error"
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
78
305
|
|
|
79
|
-
##
|
|
306
|
+
## 🎯 Use Cases
|
|
80
307
|
|
|
308
|
+
### 1. Development Debugging
|
|
81
309
|
```jsx
|
|
82
310
|
<ReqwiseDevTools
|
|
83
311
|
axiosInstance={api}
|
|
84
|
-
placement="bottom"
|
|
85
|
-
size="lg"
|
|
86
|
-
theme="dark"
|
|
87
312
|
show="detailed"
|
|
88
313
|
defaultOpen={true}
|
|
89
|
-
maxItems={1000}
|
|
90
|
-
persistHistory={true}
|
|
91
|
-
ignore={['/health', '/ping']}
|
|
92
|
-
maskHeaders={['Authorization', 'X-API-Key']}
|
|
93
|
-
maskFields={['password', 'token', 'secret']}
|
|
94
|
-
groupBy="url"
|
|
95
|
-
highlight="error"
|
|
96
|
-
langs={['en', 'tr', 'es']}
|
|
97
|
-
defaultLang="tr"
|
|
98
|
-
onRequest={(e) => console.log('Request:', e.method, e.url)}
|
|
99
|
-
onResponse={(e) => console.log('Response:', e.status)}
|
|
100
|
-
onError={(e) => console.error('Error:', e.error?.message)}
|
|
101
314
|
/>
|
|
102
315
|
```
|
|
103
316
|
|
|
104
|
-
|
|
317
|
+
### 2. API Documentation
|
|
318
|
+
```jsx
|
|
319
|
+
<ReqwiseDevTools
|
|
320
|
+
axiosInstance={api}
|
|
321
|
+
placement="right"
|
|
322
|
+
size="lg"
|
|
323
|
+
// Auto-discovers endpoints from actual traffic
|
|
324
|
+
/>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 3. Performance Monitoring
|
|
328
|
+
```jsx
|
|
329
|
+
<ReqwiseDevTools
|
|
330
|
+
axiosInstance={api}
|
|
331
|
+
highlight="slow"
|
|
332
|
+
onResponse={(e) => {
|
|
333
|
+
if (e.duration && e.duration > 1000) {
|
|
334
|
+
console.warn('Slow API:', e.url, e.duration + 'ms')
|
|
335
|
+
}
|
|
336
|
+
}}
|
|
337
|
+
/>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### 4. Error Tracking
|
|
341
|
+
```jsx
|
|
342
|
+
<ReqwiseDevTools
|
|
343
|
+
axiosInstance={api}
|
|
344
|
+
onError={(e) => {
|
|
345
|
+
// Send to Sentry, LogRocket, etc.
|
|
346
|
+
errorTracker.captureException({
|
|
347
|
+
status: e.status,
|
|
348
|
+
url: e.url,
|
|
349
|
+
error: e.error?.message,
|
|
350
|
+
})
|
|
351
|
+
}}
|
|
352
|
+
/>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
## 🔒 Security & Privacy
|
|
358
|
+
|
|
359
|
+
1. **No Network Calls:** Reqwise never sends data anywhere
|
|
360
|
+
2. **Masking Works Offline:** Sensitive data redacted before storage
|
|
361
|
+
3. **Development-Only:** Disable in production
|
|
362
|
+
4. **localStorage Isolation:** Uses dedicated key `reqwise_history_v1`
|
|
363
|
+
5. **GDPR Friendly:** TTL support for auto-deletion
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
## 🚀 Performance
|
|
368
|
+
|
|
369
|
+
- **Bundle Size:** ~8KB gzipped (React wrapper only)
|
|
370
|
+
- **Runtime Overhead:** <2ms per request
|
|
371
|
+
- **Memory Usage:** ~100KB for 200 entries
|
|
372
|
+
- **No Memory Leaks:** Proper cleanup on unmount
|
|
105
373
|
|
|
106
|
-
|
|
107
|
-
📊 **Detailed View** - Full request/response headers and bodies
|
|
108
|
-
🔍 **Filtering & Search** - Filter by URL, method, status
|
|
109
|
-
💾 **Persistent History** - LocalStorage support for request history
|
|
110
|
-
🎨 **Multiple Themes** - Dark/Light/System theme support
|
|
111
|
-
🌍 **i18n Ready** - 15+ languages supported
|
|
112
|
-
📱 **Responsive** - Works on mobile and desktop
|
|
113
|
-
⚡ **Zero Config** - Works out of the box with sensible defaults
|
|
374
|
+
---
|
|
114
375
|
|
|
115
|
-
## Browser Support
|
|
376
|
+
## 🌐 Browser Support
|
|
116
377
|
|
|
117
378
|
- Chrome/Edge 90+
|
|
118
379
|
- Firefox 88+
|
|
119
380
|
- Safari 14+
|
|
381
|
+
- All modern React versions (17+)
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## 📝 TypeScript Support
|
|
386
|
+
|
|
387
|
+
Full TypeScript support with type definitions included:
|
|
388
|
+
|
|
389
|
+
```typescript
|
|
390
|
+
import { ReqwiseDevTools } from 'reqwise-react'
|
|
391
|
+
import type { ReqwiseEntry, ReqwiseConfig } from 'reqwise-core'
|
|
392
|
+
import axios from 'axios'
|
|
393
|
+
|
|
394
|
+
const api = axios.create()
|
|
395
|
+
|
|
396
|
+
const handleResponse = (entry: ReqwiseEntry) => {
|
|
397
|
+
console.log(entry.status, entry.duration)
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export function App() {
|
|
401
|
+
return (
|
|
402
|
+
<ReqwiseDevTools
|
|
403
|
+
axiosInstance={api}
|
|
404
|
+
onResponse={handleResponse}
|
|
405
|
+
/>
|
|
406
|
+
)
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## ⚙️ Core Modules (via reqwise-core)
|
|
413
|
+
|
|
414
|
+
### `client.ts` — HTTP Interception Engine
|
|
415
|
+
- `initClient(config)` — Initialize with configuration
|
|
416
|
+
- `recordPartial(entry)` — Record partial entry (request or response)
|
|
417
|
+
- `wrapAxios(instance)` — Setup Axios interceptors
|
|
418
|
+
- `get/post/put/patch/delete(url, data?, config?)` — HTTP methods with fallback to fetch
|
|
419
|
+
|
|
420
|
+
### `storage.ts` — Persistent & In-Memory Storage
|
|
421
|
+
- `initStorage(config)` — Setup storage backend
|
|
422
|
+
- `saveEntry(entry)` — Save entry to memory and localStorage (if enabled)
|
|
423
|
+
- `getEntries()` — Retrieve all entries (newest first)
|
|
424
|
+
- `subscribe(callback)` — Listen for storage changes
|
|
425
|
+
- TTL enforcement — auto-delete entries older than `historyTTL` days
|
|
426
|
+
- Limit enforcement — keep only latest `maxItems` entries
|
|
427
|
+
|
|
428
|
+
### `filter.ts` — Security & Pattern Matching
|
|
429
|
+
- `shouldIgnore(url)` — Check if URL matches ignore patterns
|
|
430
|
+
- `maskHeaders(headers)` — Redact sensitive headers with `****`
|
|
431
|
+
- `maskFields(obj)` — Recursively redact nested object fields
|
|
432
|
+
- Pattern matching — supports regex and substring matching
|
|
433
|
+
|
|
434
|
+
### `panel.ts` — DOM & Hotkey Management
|
|
435
|
+
- `mount(config)` — Inject panel into document.body
|
|
436
|
+
- `unmount()` — Remove panel and clean up event listeners
|
|
437
|
+
- `open()` / `close()` / `toggle()` — Panel state management
|
|
438
|
+
- Hotkey listener — parse and bind keyboard shortcut
|
|
439
|
+
- Placement handling — position panel relative to viewport
|
|
440
|
+
- Theme application — data-theme attribute for CSS scoping
|
|
441
|
+
|
|
442
|
+
### `renderer.ts` — Tab System & UI Rendering
|
|
443
|
+
- `renderTabs()` — Render and switch between 4 tabs
|
|
444
|
+
- `renderCurrent()` — Show requests from current page
|
|
445
|
+
- `renderHistory()` — Show all requests with filters
|
|
446
|
+
- `renderSendRequest()` — Mini HTTP client form
|
|
447
|
+
- `renderEndpoints()` — API endpoint analytics
|
|
448
|
+
- Event listeners — "Send" button, tab switching, form submission
|
|
449
|
+
|
|
450
|
+
### `i18n.ts` — Translation Catalog
|
|
451
|
+
- `t(key, lang)` — Get translated string
|
|
452
|
+
- `setLanguage(lang)` — Update active language
|
|
453
|
+
- `getLanguage()` — Get current language
|
|
454
|
+
- **Supported languages:** en, tr, az, ru, de, fr, es, pt, zh, ja, ar, ko, it, pl, nl
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
## 🔌 API Reference (React Component)
|
|
459
|
+
|
|
460
|
+
### ReqwiseDevTools Props
|
|
461
|
+
```typescript
|
|
462
|
+
interface ReqwiseDevToolsProps {
|
|
463
|
+
axiosInstance: AxiosInstance // Axios instance to monitor
|
|
464
|
+
enabled?: boolean // Enable/disable panel (default: true)
|
|
465
|
+
placement?: Placement // Panel position (default: "right")
|
|
466
|
+
defaultOpen?: boolean // Open on mount (default: false)
|
|
467
|
+
theme?: Theme // Color theme (default: "system")
|
|
468
|
+
hotkey?: string // Keyboard shortcut (default: "ctrl+shift+e")
|
|
469
|
+
show?: "general" | "detailed" // Request card detail (default: "general")
|
|
470
|
+
size?: "sm" | "md" | "lg" | "full" // Panel size (default: "md")
|
|
471
|
+
opacity?: number // Panel opacity 0-1 (default: 1)
|
|
472
|
+
maxItems?: number // Max requests to store (default: 200)
|
|
473
|
+
persistHistory?: boolean // Save to localStorage (default: true)
|
|
474
|
+
ignore?: string[] // URL patterns to ignore (default: [])
|
|
475
|
+
maskHeaders?: string[] // Headers to mask (default: [])
|
|
476
|
+
maskFields?: string[] // JSON fields to mask (default: [])
|
|
477
|
+
groupBy?: "url" | "method" | "status" | "page" // Group requests by
|
|
478
|
+
highlight?: "error" | "slow" | "none" // Highlight type (default: "error")
|
|
479
|
+
langs?: string[] // Supported languages (default: ["en"])
|
|
480
|
+
defaultLang?: string // Initial language (default: auto-detect)
|
|
481
|
+
onRequest?: (entry: Partial<ReqwiseEntry>) => void
|
|
482
|
+
onResponse?: (entry: ReqwiseEntry) => void
|
|
483
|
+
onError?: (entry: ReqwiseEntry) => void
|
|
484
|
+
}
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
### Storage API Methods
|
|
488
|
+
```typescript
|
|
489
|
+
// Available from reqwise-core → storage module
|
|
490
|
+
storage.initStorage(config?)
|
|
491
|
+
storage.saveEntry(entry)
|
|
492
|
+
storage.getEntries() // returns all entries
|
|
493
|
+
storage.subscribe(callback) // listen for changes
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
### Panel Control Methods
|
|
497
|
+
```typescript
|
|
498
|
+
// Available from reqwise-core → panel module
|
|
499
|
+
panel.open()
|
|
500
|
+
panel.close()
|
|
501
|
+
panel.toggle()
|
|
502
|
+
panel.isMounted()
|
|
503
|
+
panel.isOpen()
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
### i18n Methods
|
|
507
|
+
```typescript
|
|
508
|
+
// Available from reqwise-core → i18n module
|
|
509
|
+
i18n.t(key, lang?) // Get translation
|
|
510
|
+
i18n.setLanguage(lang) // Set active language
|
|
511
|
+
i18n.getLanguage() // Get current language
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
## 🌐 Supported Languages
|
|
517
|
+
|
|
518
|
+
| Code | Language | Code | Language |
|
|
519
|
+
|------|----------|------|----------|
|
|
520
|
+
| en | English | tr | Türkçe (Turkish) |
|
|
521
|
+
| az | Azərbaycanca | ru | Русский (Russian) |
|
|
522
|
+
| de | Deutsch | fr | Français |
|
|
523
|
+
| es | Español | pt | Português |
|
|
524
|
+
| zh | 中文 (Chinese) | ja | 日本語 (Japanese) |
|
|
525
|
+
| ar | العربية (Arabic) | ko | 한국어 (Korean) |
|
|
526
|
+
| it | Italiano | pl | Polski |
|
|
527
|
+
| nl | Nederlands |
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## 📊 Browser & Environment Support
|
|
532
|
+
|
|
533
|
+
- **Node.js:** 14+ (for SSR checks, no DOM operations)
|
|
534
|
+
- **Browsers:** Chrome, Firefox, Safari, Edge (all modern versions)
|
|
535
|
+
- **React:** 17+ (the ReqwiseDevTools component)
|
|
536
|
+
- **Framework:** Works with any React version 17+
|
|
537
|
+
|
|
538
|
+
---
|
|
539
|
+
|
|
540
|
+
## 🚀 Performance Considerations
|
|
541
|
+
|
|
542
|
+
- **Bundle Size:** ~8KB gzipped (React wrapper only; includes ~15KB core)
|
|
543
|
+
- **Runtime Overhead:** <2ms per request (timing measurement)
|
|
544
|
+
- **Memory Usage:** ~100KB for 200 entries (default limit)
|
|
545
|
+
- **Storage:** ~50KB in localStorage for 200 typical entries
|
|
546
|
+
- **No Memory Leaks:** Proper cleanup on component unmount
|
|
547
|
+
- **Lazy Loading:** Core modules load dynamically when needed
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
## 📝 Changelog
|
|
552
|
+
|
|
553
|
+
### v1.2.0 (Current)
|
|
554
|
+
- Fixed scroll functionality in all tabs with proper flex layout constraints
|
|
555
|
+
- Fixed panel sizing for top/bottom placements (100vw width)
|
|
556
|
+
- Fixed toggle button positioning for all placement types (left, right, top, bottom)
|
|
557
|
+
- Fixed panel transform directions on toggle for top/bottom placements
|
|
558
|
+
- Added expand/collapse buttons for request/response content in Current tab
|
|
559
|
+
- Fixed full-size panel button positioning (inside panel when open, outside when closed)
|
|
560
|
+
- Comprehensive React README documentation with core package structure
|
|
561
|
+
- Added Architecture Flow, TypeScript data models, and Core Modules documentation
|
|
562
|
+
- Added API Reference and Supported Languages to React README
|
|
563
|
+
- Performance Considerations and comprehensive feature documentation
|
|
564
|
+
|
|
565
|
+
### v1.1.4
|
|
566
|
+
- Updated React README with comprehensive documentation
|
|
567
|
+
- Full API reference aligned with core package
|
|
568
|
+
- Architecture flow diagrams
|
|
569
|
+
- TypeScript data models documentation
|
|
570
|
+
- Supported languages table
|
|
571
|
+
|
|
572
|
+
### v1.1.3
|
|
573
|
+
- Improved documentation with comprehensive examples
|
|
574
|
+
- Enhanced TypeScript types and interfaces
|
|
575
|
+
- Stable callback system (onRequest, onResponse, onError)
|
|
576
|
+
- TTL support for automatic history cleanup
|
|
577
|
+
- Better error handling and logging
|
|
578
|
+
|
|
579
|
+
### v1.1.2
|
|
580
|
+
- Added callback hooks (onRequest, onResponse, onError)
|
|
581
|
+
- Introduced TTL (Time-To-Live) for history entries
|
|
582
|
+
- Enhanced filtering capabilities
|
|
583
|
+
- Improved renderer performance
|
|
584
|
+
|
|
585
|
+
### v1.1.0
|
|
586
|
+
- Introduced Endpoints tab with auto-discovery
|
|
587
|
+
- Added size and opacity props
|
|
588
|
+
- Improved UI responsiveness
|
|
589
|
+
|
|
590
|
+
### v1.0.0
|
|
591
|
+
- Initial React component release
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## 📚 Resources
|
|
596
|
+
|
|
597
|
+
- [Reqwise Core](https://www.npmjs.com/package/reqwise-core) — Core package
|
|
598
|
+
- [GitHub](https://github.com/reqwise/reqwise) — Source code & issues
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
## 📄 License
|
|
603
|
+
|
|
604
|
+
MIT © Ali Zadeh
|
|
605
|
+
|
|
606
|
+
---
|
|
120
607
|
|
|
121
|
-
##
|
|
608
|
+
## 🤝 Contributing
|
|
122
609
|
|
|
123
|
-
|
|
610
|
+
Contributions are welcome! Since Reqwise React is a wrapper around reqwise-core, please refer to the [main repository](https://github.com) for contribution guidelines. Bug reports, feature requests, and pull requests are appreciated.
|
|
124
611
|
|
|
125
|
-
|
|
612
|
+
---
|
|
126
613
|
|
|
127
|
-
|
|
128
|
-
- [Reqwise CLI](https://github.com/reqwise/reqwise) - Command-line tool
|
|
614
|
+
**Reqwise** makes debugging HTTP requests in React apps dramatically easier. Enjoy! 🎉
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reqwise-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"exports": {
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"type-check": "tsc -p tsconfig.json --noEmit"
|
|
17
|
+
},
|
|
14
18
|
"peerDependencies": {
|
|
15
19
|
"axios": ">=1.0.0",
|
|
16
20
|
"react": ">=17.0.0"
|
|
@@ -21,16 +25,12 @@
|
|
|
21
25
|
}
|
|
22
26
|
},
|
|
23
27
|
"dependencies": {
|
|
24
|
-
"reqwise-core": "
|
|
28
|
+
"reqwise-core": "workspace:^"
|
|
25
29
|
},
|
|
26
30
|
"devDependencies": {
|
|
27
31
|
"@types/node": "^25.8.0",
|
|
28
32
|
"@types/react": "^18.0.0",
|
|
29
33
|
"typescript": "^5.0.0",
|
|
30
34
|
"tsup": "^8.5.0"
|
|
31
|
-
},
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsup",
|
|
34
|
-
"type-check": "tsc -p tsconfig.json --noEmit"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|