如何在获取请求标头中设置x-validate-host?

时间:2019-01-03 13:52:44

标签: angular

我想在请求标题中设置 x-validate-host 。这是我的代码段

import { Injectable } from "@angular/core";
import { HttpClient, HttpHeaders} from '@angular/common/http';
import 'rxjs/add/operator/map';


@Injectable()
export class CaptureService {

constructor(private http: HttpClient) {}

    fetchCertInfo(hostname) {
    let headers = new HttpHeaders({"x-validate-host": hostname});

        return this.http.get('https://api.blupig.net/certificate- 
        info/validate', {headers: headers})
        .map((response)=> {
            return response;
         },
         error => {
            return error.json();
         })
     }
}

而是在标头中进行设置,而是设置Access-Control-Request-Headers:x-validate-host。

任何人都可以帮助我,如何在请求标头中设置x-validate-host:www.abc.com?

attached error image here

0 个答案:

没有答案