Friday 19 May 2017

The right way to construct HTTP request to API in Nodejs and Express

I'm totally new to HTTP and trying to make HTTP request. Here is the API:

enter image description here

I construct the request like this:

let reqString = 'GET https://login.yandex.ru/info?format=json&with_openid_identity=1 HTTP/1.1\r\n' +
          'Authorization: OAuth ' + this.token;

And here is the error:

Error: Invalid URI "GET%20https://login.yandex.ru/info?format=json&with_openid_identity=1%20HTTP/1.1%0D%0AAuthorization:%20OAuth%20AQAAAAAc3LKEAAQQaS1B6d6nz0B8mq_kOr-AD6M"

I'm totally new to HTTP and backend at all, please, explain what I'm doing wrong and show me the right way

Thanks in advance



via Commercial Suicide

No comments:

Post a Comment