Remove the unnecessary OR operation while getting the content type in `getData` (#7604)

It looks like inside the `getData` function we are getting the
`contentType` from the header. But while doing it, we have a weird
`''.startsWith('text/html');` after an OR operator. I think this might
be a forgotten artifact while refactoring that code.
`''.startsWith('text/html');` always returns false, which was confusing
to me while I was looking at this function. And below that line, we have
a check for `contentType` to see if it's "application/json".

See:
eccd74e32e/ui/helpers/http.js (L24)
This commit is contained in:
Nazım Can Altınova 2022-12-21 20:46:32 +01:00 коммит произвёл GitHub
Родитель 1bd399f11d
Коммит 4238c2c1fc
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -18,8 +18,7 @@ export const getData = async function getData(url, options = {}) {
failureStatus = response.status;
}
const contentType =
response.headers.get('content-type') || ''.startsWith('text/html');
const contentType = response.headers.get('content-type');
if (contentType && contentType !== 'application/json' && failureStatus) {
const errorMessage = processErrorMessage(