I need to send username and password as request headers (not query parameters) in a HTTP request.
I have the following get method written inside an Angular service.
http.get() {
let headers_object = new HttpHeaders();
headers_object.append('username', 'Test');
headers_object.append('password', 'Test123');
const httpOptions = {
headers: headers_object
};
const uri = 'http://localhost:8083/test';
let res;
this.http.get(uri, httpOptions)
.pipe(map(data => data)).subscribe(result => {
console.log(result);
res = result;
});
return res;
}
Any help in this direction will be much appreciated.
Thanks!
