I have built a simple fetch wrapper which can send post requests. When I try to send a post request to this endpoint (https://cdn.utm-shop.de/bookings/availability?serviceId=xxxxxxxxxxx&dateFrom=2024-03-20&dateTo=2024-04-20 ) then I receive an correct response. Then I change some data and call this endpoint again. And it still respond with the old data. Maybe after 2-5 Minutes it responds correctly. When I call the endpoint with curl or Postman, it responses correctly immediately.
async function post(url, body = {}, headers = {}) {
const requestOptions = {
method: 'POST',
headers: headers,
body: body
};
return await fetch(url, requestOptions).then(response => {
return response.json()
}).then(data => {
return data
})
}
I have tried following solutions which not worked for me:
Added no-cache header
Added cache:no-cache to requestOption
Added a dummy query parameter with the timestamp, so the requests are different