title | issue | author | author_email |
---|---|---|---|
204 footer empty |
NEXT-26984 |
oskroblin Skroblin |
o.skroblin@shopware.com |
- 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
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
}
}
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
}
});