2017-05-12 8 views
0
let headers1 = new Headers({'Content-Type': 'application/json'}); 
     headers1.append('X-Authorization','some code'); 
    let options = new RequestOptions({ headers: headers1,body: {} }); 
     this.http.get('http://locahost:8080/dmat/logmgr/v1/reports/all?calFilterType=Day&date=2017-05-05'+paramerter, options).subscribe(
     (data => { 
      if(data.json().status === '200'){ 
       console.log('data',data); 
      }else { 

      }; 
     }) 
    ); 

コンソールにエラーはありません。しかし、私はクロムの[ネットワーク]タブの[要求されたヘッダ]タブで自分のヘッダを見ることができません。

答えて

0
headers = new Headers(); 


getData() { 
    headers.append('Content-Type', 'application/json'); 

    return this.http.get('URL',{headers: this.headers}) 
    .map((res: Response) => res.json()); 
} 
+0

これは私のサービスファイル プライベートヘッダーです。 \tコンストラクタ(プライベートhttp:Http){ this.headers = new Headers(); } \tプライベートgetReports = 'レポート/すべて?calFilterType =日&日付= 2017-05-05'; getLogData(パラメータ:any){ //this.headers.append('Content-Type '、' application/json '); this.headers.append( 'X-Authorization'、 'SOME TOKEN'); \t \t戻り値this.http.get(this.Url + this.getReports +パラメータ、{headers:this.headers}).map((res:Response)=> res.json()); } –

+0

これは私が 公共getLogData(値:任意)は、このサービスを呼び出すAM WHERE FROM MY CompoNetをファイルである{ this.logManagerService.getLogData(値).subscribe(=データ データ=> { this.testResponse; コンソール.log( "私はここにデータを見ることができません"、this.testResponse); } ); –

関連する問題