I’m experiencing an issue where an API works fine when tested in Postman but returns a blank response when accessed through my application in a Chrome browser. The API call receives a status code of 200 OK, but the response body is empty.
export const searchData = createAsyncThunk(
'flights/searchDataApi',
async ({ department, filter, view, username, postData }) => {
try {
const url = `${SEARCH_URL}?filter=${filter}&view=${view}`;
const response = await axios.post(url, postData);
return response.data;
} catch (error) {
throw error;
}
}
)
I’m also getting some error in console:
EDIT:
I tried like below also, same issue persist:
const response = await axios.post(url, postData, {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
}
});