I am trying to talk to the API using TypeScript and jQuery (from a specific type).
let ajaxsettings: JQueryAjaxSettings = { url: this.url, contentType: "application/json", type: "POST", data: JSON.stringify(this.apiRequest), processData: false, success: ( data, textStatus, jQxhr ) => { console.log("Response:" + JSON.stringify(data)); }, error: ( jqXhr, textStatus, errorThrown ) => { console.log("Error Response; " + JSON.stringify(jqXhr)); }, headers: { "X-UserName": "blahblah", "X-Password": "blahblah" }, beforeSend: (request) => { request.setRequestHeader("X-APIKey", "blahblahblah"); } }; $.ajax(ajaxsettings);
Running a query and looking at what Fiddler captures is rather strange.

The HTTP verb is invalid and the headers are not included in the Access-Control-Request headers as a standard header.
JQuery 3.2.0 and the most recent index.d.ts of definitely typed .
I can create an HTTP request in Fiddler:

The query I'm trying to create is:

Update
I tried manipulating dataType to get around pre-flight checks :
contentType : "text/plain", method: "POST", type: "post", dataType: "json",
Update 2
The API is hosted in IIS Express from Visual Studio 2017 (using .NET Core), and the website is hosted using the lite-server.This code works fine when displaying custom headers.
jquery typescript
wonea
source share