First of all, I want to say that I'm a beginner and am trying to solve a task involving downloading an Excel file from the backend in a project. Front-end : React & Redux & Rtk Query Back-end: Java & Spring
The problem I'm facing is that I can't use RKT Query to download the file because of caching. Therefore, I have decided to retrieve the file using the Fetch API.
However, I'm struggling with the fact that the name of the file should be delivered from the backend, and as I understand it, this requires the Content-disposition header to be present. When I make a simple fetch request and check the Network tab in the dev tools, I can see the Content-disposition header. But when I try to log the response in the code, the Content-disposition seems to be missing.
The code is simply a fetch API method.
This is the first time I need to get a name from the backend, and to be honest, I have no clue what I'm doing wrong.
I have included an image of the Response Headers from the dev tools, along with what the console.log output looks like.