spooder 4.2.15 → 4.2.16
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 +1 -1
- package/package.json +1 -1
- package/src/api.ts +2 -2
package/README.md
CHANGED
|
@@ -676,7 +676,7 @@ By default requests that take longer than `1000ms` to process will trigger the c
|
|
|
676
676
|
> If your canary reports to a public repository, be cautious about directly including the `req` object in the callback. This can lead to sensitive information being leaked.
|
|
677
677
|
|
|
678
678
|
```ts
|
|
679
|
-
server.on_slow_request(async (req, time) => {
|
|
679
|
+
server.on_slow_request(async (req, time, url) => {
|
|
680
680
|
// avoid `time` in the title to avoid canary spam
|
|
681
681
|
// see caution() API for information
|
|
682
682
|
await caution('Slow request warning', { req, time });
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -586,7 +586,7 @@ export function serve(port: number) {
|
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
588
|
|
|
589
|
-
type SlowRequestCallback = (req: Request, request_time: number) => void;
|
|
589
|
+
type SlowRequestCallback = (req: Request, request_time: number, url: URL) => void;
|
|
590
590
|
|
|
591
591
|
let slow_request_callback: SlowRequestCallback | null = null;
|
|
592
592
|
let slow_request_threshold: number = 1000;
|
|
@@ -603,7 +603,7 @@ export function serve(port: number) {
|
|
|
603
603
|
const request_time = Date.now() - request_start;
|
|
604
604
|
|
|
605
605
|
if (slow_request_callback !== null && request_time > slow_request_threshold)
|
|
606
|
-
slow_request_callback(req, request_time);
|
|
606
|
+
slow_request_callback(req, request_time, url);
|
|
607
607
|
|
|
608
608
|
return print_request_info(req, response, url, request_time);
|
|
609
609
|
}
|