I've got a new API from the backend team in a new project, when I call the api it returns "you need to enable java...", whereas I had used Postman for another project before... is it related to api, server or something else?
-
7i would guess your `URL` is wrong. can you try accessing it from the browser? – Rafael Herscovici Jan 23 '20 at 09:27
-
3Yeah this looks like your calling the page rather than the endpoint and so is returning your index.html by the looks of it. I'd look into making sure you have the current URL. – Inch High Jan 23 '20 at 09:45
-
1Yes it was, the server port was different. – Hamid Shoja Jan 23 '20 at 09:45
6 Answers
I spent some times pondering on this trepidation.. and then suddenly i realized what was going on..
- the endpoint does not exist, it could be a misspelling
- not in the same directory as you expect it to be,
try adding or removing "/" at the beginning of the url, particularly if you don't specify the hostname, i.e.
fetch('getusername')
is different fromfetch('/getusername')
. . This acceptable in development but NOT when already deployed, it points to different path. - the endpoint may be working fine in the Development, but somewhere within in the Production/Staging, it generated some exception.

- 12,582
- 6
- 26
- 49

- 186
- 2
- 7
I don't think that POSTMAN is capable of executing JavaScript in its console. Try doing the same in the web browser it will work (You won't see this error message).

- 2,179
- 5
- 28
- 53
I had this problem with a project built using the new template in Visual Studio 2022 for a React app with .NET Core.
In my case I was only getting the response "You need to enable JavaScript to run this app" with calls to a new controller I added. Calls to the built-in WeatherForecastController were working just fine. My new controller was configured the same as the built-in controller so I could not figure out why this was happening. It has to do with how this project template creates both a React app and a back-end API both accessible on the same port. There's a setupProxy.js file that defines routes that should be forwarded to the API. All other routes are redirected to index.html. This is actually what was happening in my case, because my new controller had not been added to setupProxy.js the middleware was redirecting the request to index.html, and because it came from Postman rather than a browser the message regarding enabling JavaScript is displayed.
The solution is that each controller must be explicitly mapped in setupProxy.js or else it won't be proxied correctly. After making this change it worked perfectly in Postman as well as fetch calls from the React app.
const context = [
"/weatherforecast", // built-in controller than comes with the project template in VS2022
"/recaptcha" // controller I created (this line must be added)
];

- 383
- 4
- 11
While calling the REST API with the postman, if you miss the end-point, then also this issue will come, add the end-point to the URL and check

- 11
- 1
I updated Postman and now it works. I'm not sure if it was because of the update or the restart.

- 164
- 6