I
I
Ivan Ivanovich2020-06-17 10:56:15
Node.js
Ivan Ivanovich, 2020-06-17 10:56:15

404 error on request?

Hello. I am making a request to check google captcha.

const requestVerif = ()=>{
          https.get(verifUrl, (resp) => {
            let data = '';
          
            resp.on('data', (chunk) => {
              data += chunk;
            });
          
            resp.on('end', () => {
              console.log(data);
            });
          
          }).on("error", (err) => {
            console.log("Error: " + err.message);
          });
        };

        requestVerif();


verifUrl is exactly correct, because if I go to the address in the browser, the result is successful.

Error while executing the request:

<HTML>
<HEAD>
<TITLE>Not Found</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Not Found</H1>
<H2>Error 404</H2>
</BODY>
</HTML>


Pure node

Please tell me why this occurs and how to fix it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Didenko, 2020-06-17
@IwanQ

If https is a built-in node module, then you access your host + the URL that you specified, respectively, it will return 404, because you do not have such a route. If you need to fetch this URL, you can put the fetch package for the node or axios, for example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question