Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 1.56 KB

2024-01-16-204-footer-empty.md

File metadata and controls

54 lines (42 loc) · 1.56 KB
title issue author author_email
204 footer empty
NEXT-26984
oskroblin Skroblin

Core

  • Changed response code from 400 to 204 when you request a service or footer navigation of a sales channel which has no configuration for it.
  • Added HttpException::is function which can be used to check if an exception is of a specific error code

Upgrade Information

New HttpException::is function

The new HttpException::is function can be used to check if an exception is of a specific error code.

try {
    // do something
} catch (HttpException $exception) {
    if ($exception->is(CategoryException::FOOTER_CATEGORY_NOT_FOUND)) {
        // handle empty footer or service navigation
    }
} 

204 response for empty footer/service navigation

The response code for empty footer or service navigation has been changed from 400 to 204. This is to prevent unnecessary error logging in the browser console and to be more consistent with the response code for different kind of sales channel navigations.

// show example how to handle in javascript a 404 response for footer navigation
this.client.get('/store-api/navigation/footer-navigation/footer-navigation', {
    headers: this.basicHeaders
}).then((response) => {
    if (response.status === 400) {
        // handle empty footer
    }
});


// after
this.client.get('/store-api/navigation/footer-navigation/footer-navigation', {
    headers: this.basicHeaders
}).then((response) => {
    if (response.status === 204) {
        // handle empty footer
    }
});