H
H
Hazrat Hajikerimov2017-08-26 16:38:42
JavaScript
Hazrat Hajikerimov, 2017-08-26 16:38:42

Why does the request to the server not work only in firefox?

fetch (whatwg-fetch polyfill) request works in all browsers (even IE) but fails in Firefox:

const headers = new Headers()
    headers.append('Content-Type', 'application/json')
    headers.append('user', '*****')
    const request = new Request('**********', {
        headers: headers
    })

    return window.fetch(request)
        .then(response => response.json())
        .then(result => {
            console.log(result)
        })
        .catch(e => {
            console.log('ошибка')
            console.log(e)
        })

It works in all browsers, but it does not work in firefox and in the console:
TypeError: NetworkError when attempting to fetch resource.

Header Access-Control-Allow-Origin * set
Also tried on axios, same situation

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question