[Fixed] Angular 8 – httpClient Get method transforms to Options method


I am trying to send Get request to my server(Microsoft 2012). I have already added this solution. But in this is solution my get request transformed to Options method.

const httpOptions = {
  headers: new HttpHeaders({
    'Content-Type': 'application/vnd.sas.datamgmt.jobflow.metadata+json; charset=utf-8',
    'Authorization': 'Basic' + btoa('username:password')

I also added:

    httpOptions.headers.set('username', 'password');
    httpOptions.headers.append('Access-Control-Allow-Origin', '*');
    httpOptions.headers.append('Access-Control-Allow-Credentials', 'true');
    httpOptions.headers.append('Access-Control-Allow-Methods', 'GET,POST,OPTIONS');
    this.typesOfDBs = this.http.get<Info[]>(this.ROOT_URL, httpOptions);

I watched my request and I saw the request is now Options request. How can I handle it and send request as Get method?


I used nodejs proxy to solve this question. Nodejs handled it easily. You must send request to nodejs from angular. And to restapi from nodejs.

Leave a Reply

(*) Required, Your email will not be published