I created a Web application built with React.Js and Asp.Net core with C#.
When I do Request from Postman
or Swagger
I have the headers
from Response.From Swagger:
And for the postman is the same result.
In React.js I call my endpoint with the following code:
const res = await fetch(url, options);const data = await res.json();console.log("Head " ,res);
My console.log
from inspect in app is( the headers is empty):
I do fetch my endpoint with options for Authorization but the Response
have empty Headers. Why??
From libary with path node_modules\typescript\lib\lib.dom.d.ts\fetch
And my Fetch:
My program.json
{"name": "linkedin","private": true,"version": "0.0.0","type": "module","scripts": {"dev": "vite","start": "vite preview","lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0","preview": "vite preview","build": "vite build --watch" },"dependencies": {"@cloudinary/react": "^1.13.0","@cloudinary/url-gen": "^1.20.0","@fortawesome/fontawesome-free": "^6.6.0","@fortawesome/fontawesome-svg-core": "^6.6.0","@fortawesome/free-solid-svg-icons": "^6.6.0","@fortawesome/react-fontawesome": "^0.2.2","@react-icons/all-files": "^4.1.0","axios": "^1.6.8","cloudinary": "^2.4.0","cors": "^2.8.5","express": "^4.19.2","mssql": "^10.0.2","multer": "^1.4.5-lts.1","path": "^0.12.7","primeicons": "^7.0.0","primereact": "^10.8.2","react": "^18.2.0","react-datepicker": "^7.3.0","react-dom": "^18.2.0","react-icons": "^5.1.0","react-router-dom": "^6.23.1","watch": "^0.13.0" },"devDependencies": {"@types/react": "^18.2.66","@types/react-dom": "^18.2.22","@vitejs/plugin-react": "^4.2.1","eslint": "^8.57.0","eslint-plugin-react": "^7.34.1","eslint-plugin-react-hooks": "^4.6.0","eslint-plugin-react-refresh": "^0.4.6","vite": "^5.4.0","webpack-dev-server": "^5.0.4" }}
Do you have any solution for my problem?