reqwise-react 1.1.3 → 1.1.4
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/README.md +255 -66
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,87 @@
|
|
|
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.1.3 | **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
|
+
- **Auto-Cleanup:** Configurable `maxItems` limit with oldest-first eviction strategy
|
|
22
|
+
- **TTL Support:** Automatic deletion of entries older than configurable `historyTTL` (in days)
|
|
23
|
+
|
|
24
|
+
### 🛡️ Security & Privacy
|
|
25
|
+
- **Header Masking:** Redact sensitive headers like `Authorization`, `Cookie`, `X-API-Key`
|
|
26
|
+
- **Field Masking:** Obfuscate nested JSON fields like `password`, `token`, `ssn`, `cvv`
|
|
27
|
+
- **Smart Ignore Patterns:** Skip unwanted URLs with regex/substring matching
|
|
28
|
+
- **No Data Transmission:** All data stays local; no external calls made
|
|
29
|
+
|
|
30
|
+
### 🌍 Internationalization (i18n)
|
|
31
|
+
- **15 Languages Built-in:** English, Turkish, Azerbaijani, Russian, German, French, Spanish, Portuguese, Chinese, Japanese, Arabic, Korean, Italian, Polish, Dutch
|
|
32
|
+
- **Runtime Switching:** Language selector in the panel
|
|
33
|
+
- **Smart Detection:** Auto-detects browser language
|
|
34
|
+
|
|
35
|
+
### ⌨️ Keyboard & Hotkey Support
|
|
36
|
+
- **Customizable Hotkeys:** Toggle panel with keyboard shortcut (default: `ctrl+shift+e`)
|
|
37
|
+
- **Cross-platform:** Works on Windows, Mac, Linux
|
|
38
|
+
|
|
39
|
+
### 🎨 UI & UX Enhancements
|
|
40
|
+
- **4 Tabbed Interface:**
|
|
41
|
+
- **Current Tab:** Requests from current page
|
|
42
|
+
- **History Tab:** All captured requests with filtering (method, status, page)
|
|
43
|
+
- **Send Tab:** Mini HTTP client — compose and send test requests
|
|
44
|
+
- **Endpoints Tab:** Auto-discovered API endpoints with statistics
|
|
45
|
+
- **Placement Flexibility:** 4 positions (top, right, bottom, left)
|
|
46
|
+
- **Theme Support:** Dark, Light, and System themes
|
|
47
|
+
- **Responsive Sizing:** 4 size presets (sm, md, lg, full)
|
|
48
|
+
- **Opacity Control:** Configurable opacity (0.0–1.0)
|
|
49
|
+
|
|
50
|
+
### 🔍 Filtering & Search
|
|
51
|
+
- **Method Filter:** GET, POST, PUT, PATCH, DELETE
|
|
52
|
+
- **Status Filter:** All, Success (2xx), Client Errors (4xx), Server Errors (5xx)
|
|
53
|
+
- **URL Search:** Text filter by URL patterns
|
|
54
|
+
|
|
55
|
+
### 📊 Endpoint Intelligence
|
|
56
|
+
- **Auto-Discovery:** Learns all API endpoints from captured requests
|
|
57
|
+
- **Statistics:** Per-endpoint hit count, HTTP methods, parameter types
|
|
58
|
+
- **Example Collection:** Stores real-world parameter examples
|
|
59
|
+
|
|
60
|
+
### 📤 Advanced Features
|
|
61
|
+
- **Callback Hooks:**
|
|
62
|
+
- `onRequest(entry)` — fires when request starts
|
|
63
|
+
- `onResponse(entry)` — fires on successful response
|
|
64
|
+
- `onError(entry)` — fires on HTTP error
|
|
65
|
+
- **Request Grouping:** Group by URL, method, status, or page
|
|
66
|
+
- **Highlight Mode:** Highlight error or slow requests
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 📦 Installation
|
|
6
71
|
|
|
7
72
|
```bash
|
|
8
|
-
npm install reqwise-react
|
|
73
|
+
npm install reqwise-react axios
|
|
9
74
|
# or
|
|
10
|
-
pnpm add reqwise-react
|
|
75
|
+
pnpm add reqwise-react axios
|
|
11
76
|
```
|
|
12
77
|
|
|
13
|
-
|
|
78
|
+
**Note:** Axios is optional but recommended for auto-capture. You can use Reqwise without it via manual recording.
|
|
14
79
|
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 🚀 Quick Start
|
|
83
|
+
|
|
84
|
+
### Basic Setup
|
|
15
85
|
```jsx
|
|
16
86
|
import { ReqwiseDevTools } from 'reqwise-react'
|
|
17
87
|
import axios from 'axios'
|
|
@@ -23,106 +93,225 @@ export default function App() {
|
|
|
23
93
|
|
|
24
94
|
return (
|
|
25
95
|
<>
|
|
26
|
-
<ReqwiseDevTools
|
|
27
|
-
|
|
28
|
-
placement="right"
|
|
29
|
-
defaultOpen={false}
|
|
30
|
-
theme="dark"
|
|
31
|
-
/>
|
|
32
|
-
{/* Your app content */}
|
|
96
|
+
<ReqwiseDevTools axiosInstance={api} />
|
|
97
|
+
{/* Your app */}
|
|
33
98
|
</>
|
|
34
99
|
)
|
|
35
100
|
}
|
|
36
101
|
```
|
|
37
102
|
|
|
38
|
-
|
|
103
|
+
### Production Configuration
|
|
104
|
+
```jsx
|
|
105
|
+
import { ReqwiseDevTools } from 'reqwise-react'
|
|
106
|
+
import axios from 'axios'
|
|
107
|
+
|
|
108
|
+
const api = axios.create({
|
|
109
|
+
baseURL: 'https://api.example.com',
|
|
110
|
+
timeout: 5000,
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
export default function App() {
|
|
114
|
+
return (
|
|
115
|
+
<ReqwiseDevTools
|
|
116
|
+
axiosInstance={api}
|
|
117
|
+
enabled={process.env.NODE_ENV === 'development'}
|
|
118
|
+
placement="right"
|
|
119
|
+
theme="dark"
|
|
120
|
+
show="detailed"
|
|
121
|
+
size="lg"
|
|
122
|
+
defaultOpen={false}
|
|
123
|
+
maxItems={500}
|
|
124
|
+
persistHistory={true}
|
|
125
|
+
hotkey="ctrl+shift+e"
|
|
126
|
+
langs={['en', 'tr']}
|
|
127
|
+
defaultLang="en"
|
|
128
|
+
ignore={['/health', '/ping']}
|
|
129
|
+
maskHeaders={['Authorization', 'X-API-Key']}
|
|
130
|
+
maskFields={['password', 'token', 'secret']}
|
|
131
|
+
groupBy="url"
|
|
132
|
+
highlight="error"
|
|
133
|
+
onRequest={(e) => console.log('Request:', e.method, e.url)}
|
|
134
|
+
onResponse={(e) => console.log('Response:', e.status, e.duration)}
|
|
135
|
+
onError={(e) => console.error('Error:', e.status, e.url)}
|
|
136
|
+
/>
|
|
137
|
+
)
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Props API
|
|
39
144
|
|
|
40
145
|
### Core Configuration
|
|
41
146
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
147
|
+
| Prop | Type | Default | Description |
|
|
148
|
+
|------|------|---------|-------------|
|
|
149
|
+
| `axiosInstance` | AxiosInstance | - | Axios instance to monitor (required for auto-capture) |
|
|
150
|
+
| `enabled` | boolean | true | Enable/disable panel |
|
|
151
|
+
| `placement` | 'left' \| 'right' \| 'top' \| 'bottom' | 'right' | Panel position |
|
|
152
|
+
| `defaultOpen` | boolean | false | Open on mount |
|
|
153
|
+
| `theme` | 'dark' \| 'light' \| 'system' | 'system' | Color theme |
|
|
154
|
+
| `hotkey` | string | 'ctrl+shift+e' | Keyboard shortcut to toggle |
|
|
48
155
|
|
|
49
156
|
### Display Options
|
|
50
157
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
158
|
+
| Prop | Type | Default | Description |
|
|
159
|
+
|------|------|---------|-------------|
|
|
160
|
+
| `show` | 'general' \| 'detailed' | 'general' | Request card detail level |
|
|
161
|
+
| `size` | 'sm' \| 'md' \| 'lg' \| 'full' | 'md' | Panel size |
|
|
162
|
+
| `opacity` | number | 1 | Panel opacity (0-1) |
|
|
54
163
|
|
|
55
164
|
### Data Management
|
|
56
165
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
166
|
+
| Prop | Type | Default | Description |
|
|
167
|
+
|------|------|---------|-------------|
|
|
168
|
+
| `maxItems` | number | 500 | Max requests to store |
|
|
169
|
+
| `persistHistory` | boolean | true | Save to localStorage |
|
|
170
|
+
| `ignore` | string[] | [] | URL patterns to ignore |
|
|
171
|
+
| `maskHeaders` | string[] | [] | Headers to mask |
|
|
172
|
+
| `maskFields` | string[] | [] | JSON fields to mask |
|
|
62
173
|
|
|
63
174
|
### Grouping & Highlighting
|
|
64
175
|
|
|
65
|
-
|
|
66
|
-
|
|
176
|
+
| Prop | Type | Default | Description |
|
|
177
|
+
|------|------|---------|-------------|
|
|
178
|
+
| `groupBy` | 'url' \| 'method' \| 'status' \| 'page' | - | Group requests by |
|
|
179
|
+
| `highlight` | 'error' \| 'slow' | 'error' | Highlight type |
|
|
67
180
|
|
|
68
181
|
### Localization
|
|
69
182
|
|
|
70
|
-
|
|
71
|
-
|
|
183
|
+
| Prop | Type | Default | Description |
|
|
184
|
+
|------|------|---------|-------------|
|
|
185
|
+
| `langs` | string[] | ['en'] | Supported languages |
|
|
186
|
+
| `defaultLang` | string | 'en' | Initial language |
|
|
72
187
|
|
|
73
188
|
### Callbacks
|
|
74
189
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
190
|
+
| Prop | Type | Description |
|
|
191
|
+
|------|------|-------------|
|
|
192
|
+
| `onRequest` | (entry) => void | Called when request starts |
|
|
193
|
+
| `onResponse` | (entry) => void | Called on successful response |
|
|
194
|
+
| `onError` | (entry) => void | Called on HTTP error |
|
|
195
|
+
|
|
196
|
+
---
|
|
78
197
|
|
|
79
|
-
##
|
|
198
|
+
## 🎯 Use Cases
|
|
80
199
|
|
|
200
|
+
### 1. Development Debugging
|
|
81
201
|
```jsx
|
|
82
202
|
<ReqwiseDevTools
|
|
83
203
|
axiosInstance={api}
|
|
84
|
-
placement="bottom"
|
|
85
|
-
size="lg"
|
|
86
|
-
theme="dark"
|
|
87
204
|
show="detailed"
|
|
88
205
|
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
206
|
/>
|
|
102
207
|
```
|
|
103
208
|
|
|
104
|
-
|
|
209
|
+
### 2. API Documentation
|
|
210
|
+
```jsx
|
|
211
|
+
<ReqwiseDevTools
|
|
212
|
+
axiosInstance={api}
|
|
213
|
+
placement="right"
|
|
214
|
+
size="lg"
|
|
215
|
+
// Auto-discovers endpoints from actual traffic
|
|
216
|
+
/>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 3. Performance Monitoring
|
|
220
|
+
```jsx
|
|
221
|
+
<ReqwiseDevTools
|
|
222
|
+
axiosInstance={api}
|
|
223
|
+
highlight="slow"
|
|
224
|
+
onResponse={(e) => {
|
|
225
|
+
if (e.duration && e.duration > 1000) {
|
|
226
|
+
console.warn('Slow API:', e.url, e.duration + 'ms')
|
|
227
|
+
}
|
|
228
|
+
}}
|
|
229
|
+
/>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 4. Error Tracking
|
|
233
|
+
```jsx
|
|
234
|
+
<ReqwiseDevTools
|
|
235
|
+
axiosInstance={api}
|
|
236
|
+
onError={(e) => {
|
|
237
|
+
// Send to Sentry, LogRocket, etc.
|
|
238
|
+
errorTracker.captureException({
|
|
239
|
+
status: e.status,
|
|
240
|
+
url: e.url,
|
|
241
|
+
error: e.error?.message,
|
|
242
|
+
})
|
|
243
|
+
}}
|
|
244
|
+
/>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 🔒 Security & Privacy
|
|
250
|
+
|
|
251
|
+
1. **No Network Calls:** Reqwise never sends data anywhere
|
|
252
|
+
2. **Masking Works Offline:** Sensitive data redacted before storage
|
|
253
|
+
3. **Development-Only:** Disable in production
|
|
254
|
+
4. **localStorage Isolation:** Uses dedicated key `reqwise_history_v1`
|
|
255
|
+
5. **GDPR Friendly:** TTL support for auto-deletion
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## 🚀 Performance
|
|
260
|
+
|
|
261
|
+
- **Bundle Size:** ~8KB gzipped (React wrapper only)
|
|
262
|
+
- **Runtime Overhead:** <2ms per request
|
|
263
|
+
- **Memory Usage:** ~100KB for 200 entries
|
|
264
|
+
- **No Memory Leaks:** Proper cleanup on unmount
|
|
105
265
|
|
|
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
|
|
266
|
+
---
|
|
114
267
|
|
|
115
|
-
## Browser Support
|
|
268
|
+
## 🌐 Browser Support
|
|
116
269
|
|
|
117
270
|
- Chrome/Edge 90+
|
|
118
271
|
- Firefox 88+
|
|
119
272
|
- Safari 14+
|
|
273
|
+
- All modern React versions (17+)
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 📝 TypeScript Support
|
|
278
|
+
|
|
279
|
+
Full TypeScript support with type definitions included:
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
import { ReqwiseDevTools } from 'reqwise-react'
|
|
283
|
+
import type { ReqwiseEntry, ReqwiseConfig } from 'reqwise-core'
|
|
284
|
+
import axios from 'axios'
|
|
285
|
+
|
|
286
|
+
const api = axios.create()
|
|
287
|
+
|
|
288
|
+
const handleResponse = (entry: ReqwiseEntry) => {
|
|
289
|
+
console.log(entry.status, entry.duration)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export function App() {
|
|
293
|
+
return (
|
|
294
|
+
<ReqwiseDevTools
|
|
295
|
+
axiosInstance={api}
|
|
296
|
+
onResponse={handleResponse}
|
|
297
|
+
/>
|
|
298
|
+
)
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## 📚 Resources
|
|
305
|
+
|
|
306
|
+
- [Reqwise Core](https://www.npmjs.com/package/reqwise-core) — Core package
|
|
307
|
+
- [GitHub](https://github.com/reqwise/reqwise) — Source code & issues
|
|
308
|
+
|
|
309
|
+
---
|
|
120
310
|
|
|
121
|
-
## License
|
|
311
|
+
## 📄 License
|
|
122
312
|
|
|
123
|
-
MIT
|
|
313
|
+
MIT © Ali Zadeh
|
|
124
314
|
|
|
125
|
-
|
|
315
|
+
---
|
|
126
316
|
|
|
127
|
-
|
|
128
|
-
- [Reqwise CLI](https://github.com/reqwise/reqwise) - Command-line tool
|
|
317
|
+
**Reqwise** makes debugging HTTP requests in React apps dramatically easier. Enjoy! 🎉
|