'@capacitor-community/http post request with empty response
I am developing ionic application and using @capacitor-community/http plugin for API call.
When I call POST request which returns some response, it's working perfect.
But when I call POST request which returns empty response, it throws exception JSONException at Object.cap.fromNative.
Find below my API call.
import { Http } from '@capacitor-community/http';
const config = {'Content-Type': 'application/json',
'X-CLIENT-AUTHORIZATION': token
};
const options = {
url: url,
headers: config,
data: postBody,
};
return Http.post(options).then(res => {
console.log(res);
return res;
}).catch(err => {
console.log(err);
});
Kindly help me on this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|