Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/image-handler/image-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class ImageRequest {
* @param {Object} event - The request body.
*/
getOutputFormat(event) {
const autoWebP = process.env.AUTO_WEBP;
const autoWebP = (process.env.AUTO_WEBP === "Yes");
if (autoWebP && event.headers.Accept && event.headers.Accept.includes('image/webp')) {
return 'webp';
} else if (this.requestType === 'Default') {
Expand Down
6 changes: 3 additions & 3 deletions source/image-handler/test/test-image-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ describe('getOutputFormat()', function () {
it(`Should pass if it returns "webp" for an accepts header which includes webp`, function () {
// Arrange
process.env = {
AUTO_WEBP: true
AUTO_WEBP: "Yes"
};
const event = {
headers: {
Expand All @@ -707,7 +707,7 @@ describe('getOutputFormat()', function () {
it(`Should pass if it returns null for an accepts header which does not include webp`, function () {
// Arrange
process.env = {
AUTO_WEBP: true
AUTO_WEBP: "Yes"
};
const event = {
headers: {
Expand All @@ -725,7 +725,7 @@ describe('getOutputFormat()', function () {
it(`Should pass if it returns null when AUTO_WEBP is disabled with accepts header including webp`, function () {
// Arrange
process.env = {
AUTO_WEBP: false
AUTO_WEBP: "No"
};
const event = {
headers: {
Expand Down