Add image optimization with Cloudflare Images#999
Conversation
|
|
Hello @pilcrowonpaper, good to see you here :) looks good on first glance, I'll do another review later! |
commit: |
| } else { | ||
| const cacheControlHeader = imageResponse.headers.get("Cache-Control"); | ||
| if (cacheControlHeader !== null) { | ||
| immutable = cacheControlHeader.includes("immutable"); |
There was a problem hiding this comment.
Next.js does something more complicated and bases the optimized response on the upstream Cache-Control header. I didn't want to do anything complex for now so it just checks if the upstream image is a static content
|
It looks like the Playwright tests are failing because the test cases don't include the required |
|
@vicb |
vicb
left a comment
There was a problem hiding this comment.
Awesome @pilcrowonpaper !
I have done a frist round of review.
Could you please add JSDoc comments to added functions.
Maybe there could be separate functions to i.e. validate each parameter?
|
@vicb I updated the endpoint to match the previous behavior and return the unoptimized image as is if the image format isn't supported by Cloudflare Images |
vicb
left a comment
There was a problem hiding this comment.
Thanks a lot @pilcrowonpaper 🎉
I have done some minor refactoring to split the huge functions, add comments and fix 2 minor typos.
825072f to
d4075ea
Compare
|
Rebased + fix tests |
No description provided.