Skip to content

Commit 495bc85

Browse files
authored
fix: return 404 (#78)
1 parent 2dce1c8 commit 495bc85

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/content/adobe-commerce.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export async function handle(ctx) {
230230
}
231231

232232
if (!sku && !config.coreEndpoint) {
233-
return errorResponse(400, 'missing sku and coreEndpoint');
233+
return errorResponse(404, 'missing sku and coreEndpoint');
234234
}
235235
if (!sku) {
236236
return errorResponse(404, 'could not find sku');

src/content/handler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default async function contentHandler(ctx) {
2727

2828
const { config } = ctx;
2929
if (!config.pageType) {
30-
return errorResponse(400, 'invalid config for tenant site (missing pageType)');
30+
return errorResponse(404, 'invalid config for tenant site (missing pageType)');
3131
}
3232
ctx.log.debug('config: ', JSON.stringify(config, null, 2));
3333

test/content/handler.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ describe('contentHandler', () => {
4545
assert.equal(response.status, 405);
4646
});
4747

48-
it('returns 400 if pageType is missing', async () => {
48+
it('returns 404 if pageType is missing', async () => {
4949
const ctx = {
5050
info: { method: 'GET' },
5151
url: { pathname: '/content/product/test' },
5252
config: {},
5353
};
5454

5555
const response = await contentHandler(ctx);
56-
assert.equal(response.status, 400);
56+
assert.equal(response.status, 404);
5757
});
5858

5959
it('calls handleHelixCommerce if catalogSource is helix', async () => {

0 commit comments

Comments
 (0)