fetch get request is failing to get resource

  fetch, javascript

when I try this url in the browser, I get a success.
But when I try it with fetch, the request never gets to the server.

        let url = "http://127.0.0.1:8081/hey";

        let params = {
            method: "GET",         
        };
        fetch(url, params)
            .then((res) => {
                console.log("serverTestButton", res);
            })
            .catch(function (e) {
                console.log("error", e);
            });

Source: Ask Javascript Questions

LEAVE A COMMENT