0

Error : Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

This is my code:

import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';

import 'rxjs/add/operator/map';

@Injectable()

export class JobSearch{

constructor(private _http: Http){}

private _jobListUrl = 'https://api.shiftjobapp.com/api/v3/job_list?token=xxxx';

private _jobDetailsUrl = 'https://api.shiftjobapp.com/api/v3/job_detailed?token=xxxx';  

getJobs(){
    return this._http.post(this._jobListUrl)
        .map((response: Response) => response.json());
}

getJobDetails(){
    return this._http.post(this._jobDetailsUrl, {job_id: 1390})
        .map((response: Response) => console.log(response.json()));
}

}
Muli Yulzary
  • 2,559
  • 3
  • 21
  • 39
Rajesh Nagappan
  • 111
  • 1
  • 1
  • 6
  • Possible duplicate of [Error :Request header field Content-Type is not allowed by Access-Control-Allow-Headers](https://stackoverflow.com/questions/12409600/error-request-header-field-content-type-is-not-allowed-by-access-control-allow) – astalor Dec 06 '17 at 14:14
  • You probably don't want to expose your token like that to the internet. I've edited your post. – Muli Yulzary Dec 06 '17 at 14:15

0 Answers0