polotno-node 2.11.11 → 2.12.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/README.md +20 -0
- package/dist/assets/index-Bw37pW_y.js +561 -0
- package/dist/assets/{index.es-IW0gGbW7.js → index.es-Csa83WQy.js} +1 -1
- package/dist/index.html +1 -1
- package/index.js +2 -0
- package/instance.js +11 -4
- package/package.json +3 -3
- package/dist/assets/index-GYIcgqgy.js +0 -561
package/README.md
CHANGED
|
@@ -66,6 +66,26 @@ const instance = await createInstance({
|
|
|
66
66
|
// by default it will use chrome-aws-lambda
|
|
67
67
|
// useful to set your own rendering props or use browserless
|
|
68
68
|
browser: browser,
|
|
69
|
+
|
|
70
|
+
// requestInterceptor - optional function to intercept and modify network requests
|
|
71
|
+
// Useful when you need to:
|
|
72
|
+
// - Modify headers like User-Agent to access protected image resources
|
|
73
|
+
// - Add authentication tokens or credentials to requests
|
|
74
|
+
// - Log or monitor network traffic
|
|
75
|
+
requestInterceptor: (request) => {
|
|
76
|
+
const targetUrl = request.url();
|
|
77
|
+
if (/\.(png|jpe?g)(\?|$)/i.test(targetUrl)) {
|
|
78
|
+
console.log(`Modifying User-Agent for image request: ${targetUrl}`);
|
|
79
|
+
request.continue({
|
|
80
|
+
headers: {
|
|
81
|
+
...request.headers(),
|
|
82
|
+
'User-Agent': 'MyCustomApprovedAgent/1.0',
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
} else {
|
|
86
|
+
request.continue();
|
|
87
|
+
}
|
|
88
|
+
},
|
|
69
89
|
});
|
|
70
90
|
```
|
|
71
91
|
|