I'm trying to fetch from a REST endpoint using a model. Here's the code:
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
}));
}
});
}
For some reason, the REST endpoint is telling me that the fetch is using OPTIONS instead of GET.
I tried this answer, but it didn't work. CORS is already enabled on my endpoint and the Backbone.enableHTTP option didn't work either.
I looked at the Backbone source and I can't seem to find anything about it using OPTIONS to make any requests. Anybody have any ideas?