0
I have an API developed with Slim 3. The API worked perfectly, testing with Postman or by browser, everything worked perfectly.
I had to change the hosting. So I went up the API to new host and tested it via browser and it worked. When I tested it by Postman it returned me the error:
This site requires Javascript to work, Please enable Javascript in your browser or use a browser with Javascript support
I went back to the browser and tried the request again, only this time with the console open. I noticed that along with the request to the web service is going a request to favicon.ico
and as the file does not exist on the host it returns a 404 error along with an error page.
In the browser it works, however, when testing via Postman it returns me the error mentioned above, what did not happen in the old hosting.
This is the API code:
$app = new app($container,[
'settings' => [
'displayErrorDetails' => true
]
]);
$app->group('/venda', function () use ($app) {
$app->get('', function (Request $request, Response $response, array $args) {
return 'teste';
});
});
$app->run();
And since I haven’t passed the domain to the new hosting, I use this link to access the API:
http://apiparsoni.rf.gd/v1/venda
Is there any way to show the browser that this is an API and prevent it from making that request?
The fact that the favicon does not exist does not seem to be related to the answer you got in Postman since it does not request the favicon. What is the code of the resource you are requesting and how you requested it?
– Woss
@Phpatrick When editing a question, be careful not to add acronyms and proper names as code snippets.
– Woss
I made an edit on the question and includes more information of the resource code and the link that makes the request.
– Michel Silva
@Andersoncarloswoss But everything that is related to function names, Apis or the code itself fits within the ``, or not?
– Patrick Perdigão
@Phpatrick Function name yes; acronyms in general and proper names are part of the text and do not require special formatting.
– Woss
@Andersoncarloswoss I got beauty
– Patrick Perdigão