Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 4fe75b2

Browse files
IMSZ-563 add origin-auth to images fetch (#288)
When fetching images for authenticated origins users may use an option called 'origin-auth' as part of the fetch api. Previously, the option was not present in the types eventhough it was supported by the api. This PR adds the option to the interface.
1 parent b6a5d1a commit 4fe75b2

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/fluffy-wasps-appear.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/workers-types": patch
3+
---
4+
5+
Add 'origin-auth' to RequestInitCfPropertiesImage interface. This changes fixes types for users attempting to fetch images from authenticated sources. Before this fix, users had to manually extend the fetch interface to satisfy the TS compiler.

overrides/cf.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ interface RequestInitCfPropertiesImage extends BasicImageTransformations {
272272
* entry is the topmost layer).
273273
*/
274274
draw?: RequestInitCfPropertiesImageDraw[];
275+
/**
276+
* Fetching image from authenticated origin. Setting this property will
277+
* pass authentication headers (Authorization, Cookie, etc.) through to
278+
* the origin.
279+
*/
280+
"origin-auth"?: "share-publicly";
275281
}
276282

277283
interface RequestInitCfPropertiesImageMinify {

0 commit comments

Comments
 (0)