let username : string = 'username'; let password : string = 'password'; let headers = new Headers(); headers.append("Authorization", "Basic " + btoa(username + ":" + password)); headers.append("Content-Type", "application/x-www-form-urlencoded"); this.http.get('http://localhost:8888/api/', { headers: headers }).subscribe( data => this.example = data.text(), err => this.logError(err.text()), () => console.log('Request Complete') ); console.log(this.example);
Обсуждают сегодня