mirror of
https://github.com/github/codeql.git
synced 2026-03-20 14:36:46 +01:00
19 lines
432 B
JavaScript
19 lines
432 B
JavaScript
let base64 = require('base-64');
|
|
|
|
let url = 'http://example.org/auth';
|
|
let username = 'user';
|
|
let password = 'passwd';
|
|
|
|
let headers = new Headers();
|
|
|
|
headers.append('Content-Type', 'text/json');
|
|
headers.append('Authorization', 'Basic' + base64.encode(username + ":" + password));
|
|
|
|
fetch(url, {
|
|
method:'GET',
|
|
headers: headers
|
|
})
|
|
.then(response => response.json())
|
|
.then(json => console.log(json))
|
|
.done();
|