AnsweredAssumed Answered

esri request with use proxy and RequestPreCallback function

Question asked by soldous on Jul 3, 2017

Hello

I need to send a request with a header Accept "application/json;odata=verbose" because I need an answer in JSON format. I use esri request with RequestPreCallback function and it does what I need.

function myCallbackFunction(ioArgs) {
   ioArgs.headers.Accept = "application/json;odata=verbose"
   return ioArgs;
}
esriRequest.setRequestPreCallback(myCallbackFunction);
var requestSHP = esriRequest({
   url: "https://server.domain/_api/web/lists/GetByTitle(%27AttachmentReason%20Type%27)/items",
   handleAs: "json"
}),

But when the request is send login pop up for authentication on this site is shown. I need all request to be send under one specific user so I want to use an esri proxy with domain, user and password parametrs for this site. I configured the proxy and into the code for esri request I add 

{
useProxy:false
}

parametr. But now the response from the request is in xml format so my header Accept is not honored. 

Can anyone help me please?

 

Thanks

Zdenek

Outcomes