зеркало из https://github.com/mozilla/treeherder.git
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:
Родитель
1bd399f11d
Коммит
4238c2c1fc
|
@ -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(
|
||||
|
|
Загрузка…
Ссылка в новой задаче