diff --git a/src/lib/run-dev.js b/src/lib/run-dev.js index 190173b..3c71a51 100644 --- a/src/lib/run-dev.js +++ b/src/lib/run-dev.js @@ -251,9 +251,11 @@ function isWebAction (action) { function isRawWebAction (action) { const raw = 'raw' const webExportValue = action?.annotations?.['web-export'] + const rawHttpValue = action?.annotations?.['raw-http'] + const isRawHttp = rawHttpValue === true || rawHttpValue === 'yes' || rawHttpValue === 'true' const webValue = action?.web - return (webExportValue === raw || webValue === raw) + return (webExportValue === raw || webValue === raw || isRawHttp) } /** diff --git a/test/lib/run-dev.test.js b/test/lib/run-dev.test.js index 5eb0ce7..de91af0 100644 --- a/test/lib/run-dev.test.js +++ b/test/lib/run-dev.test.js @@ -520,6 +520,31 @@ describe('isRawWebAction', () => { }) }) +test('action.annotations.raw-http', () => { + let action + + action = { annotations: {} } + expect(isRawWebAction(action)).toBeFalsy() + + action = { annotations: { 'raw-http': 'raw' } } + expect(isRawWebAction(action)).toBeFalsy() + + action = { annotations: { 'raw-http': 'any other string value' } } + expect(isRawWebAction(action)).toBeFalsy() + + action = { annotations: { 'raw-http': false } } + expect(isRawWebAction(action)).toBeFalsy() + + action = { annotations: { 'raw-http': true } } + expect(isRawWebAction(action)).toBeTruthy() + + action = { annotations: { 'raw-http': 'yes' } } + expect(isRawWebAction(action)).toBeTruthy() + + action = { annotations: { 'raw-http': 'true' } } + expect(isRawWebAction(action)).toBeTruthy() +}) + describe('statusCodeMessage', () => { test('900 - invalid', () => { const statusCode = 900