Ich benutze fetch, um einen Post-Service aufzurufen, und ich bekomme den Fehler Fetch API cannot load http://localhost:8080/user/login
. Antwort für Preflight ist ungültig (Redirect) '. Status code: 302 Found.
Die Variable ‚data‘ ist ein json object {email: "[email protected]", password: "111"}
Abruf-API kann die URL nicht laden. Antwort für Preflight ist ungültig (Redirect)
fetch('http://localhost:8080/user/login', {
method: 'post',
body : JSON.stringify(data),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
dataType : 'json'
})
Ähnliches Problem, gelöst durch Punkt 2, d. H. Anhängen von '/'. Können Sie mehr darüber erklären, warum dies geschieht? – ajaykumar