J
J
jtag2018-09-18 14:21:53
Node.js
jtag, 2018-09-18 14:21:53

How to write an https request?

I am a client. You need to send an https request. It turns out that I do not need certificates, I just need to confirm the certificates from the server side? How to write it? I am using npm request. it is possible and on native https.

let auth = "Basic " + new Buffer("user" + ":" + "user").toString("base64");
    request({
        uri: `localhost:8443`,
        headers : {
            "Authorization" : auth,
            'Accept-Charset': 'utf-8',
        },
        method: `POST`,
        json: data
   },(error, req, body)=>{
       if (error) throw(error);   
})

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2018-09-18
@Sanasol

And here certificates, not
https certificates, add to the url and that's it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question