I'm using the js fetch() function to access to my api but I get the error
POST mywebsite net::ERR_HTTP2_PROTOCOL_ERROR
My api work perfectly with my android app, and this error appear when I add a bearer token to the header
call(url, formBody, callback) {
const requestOptions = {
method: 'POST',
headers: this.getHeader(),
body: formBody,
redirect: 'follow'
};
fetch(url, requestOptions)
.then(response => response.text())
.then(result => {
callback(result)
})
.catch(error => {
console.log('error', error)
});
}getHeader() {
const myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer " + this.getValidToken())
return myHeaders;
}
I have tried with xmlhttprequest It's the same error