Currently, I am attempting to retrieve data from a REST endpoint with the help of a model. Below is the code snippet that I am using:
professors: function(id) {
professor = new ProfessorModel({
id: id
});
professor.fetch({
headers: {
'HTTP_ACCESS_TOKEN': document.cookie
},
success: function(model, response, options) {
AppController.showView(new ProfessorView({model: model}));
},
error: function(model, response, options) {
AppController.showView(new ErrorView({
statusCode: response.status,
errorMessage: response.statusText
}));
}
});
}
Unexpectedly, the REST endpoint is indicating that the fetch operation is utilizing OPTIONS instead of GET.
Although I attempted following this solution, it did not yield any results. CORS has already been enabled on my endpoint and the Backbone.enableHTTP option also failed to resolve the issue.
Upon examining the Backbone source, I was unable to identify any reference to it using OPTIONS for requests. Does anyone have any insights or suggestions regarding this matter?