I have a RESTful service on a secured site. I can build a request just fine with the REST client in Firefox, but when I try to build it in code I get a 401. Here is my code
(function() {
$.ajax({
url : "https://myrestsite",
type : "GET",
//beforeSend: function (req){
// req.setRequestHeader("Authorization","myauthstring");
// req.setRequestHeader("Content-Type", "application/json");
//},
headers : {
"Authorization" : "myauthstring",
"Content-Type" : "application/json",
},
success : function (){alert('we got here')}
});
})();
This shows up in web developer tools in FF as:
Request-Headers:authorization,content-type
When what I need (from the rest client is FF) is:
Authorization:myAuthstring
Content-Type:application/json
Any clues as to what I am doing wrong?
**edit - turns out I am hitting the cross domain restriction. How does the rest client get around that?