Triply-Dev / YASGUI.YASQE-deprecated

Deprecated, see https://github.com/TriplyDB/Yasgui for the Yasgui monorepo
MIT License
73 stars 36 forks source link

Get request with cookie #124

Closed marcoromano91 closed 7 years ago

marcoromano91 commented 7 years ago

Hi,

I have tried to send a get request to the backend but I received a 401 http error because in the request the cookie is not set. How I can solve this issue? Is it possible to set it?

Below my code:

YASQE.executeQuery = function (cm, callBackOrConfig) { endPointSelected = endPointSelected != '' ? endPointSelected : yasqe.options.sparql.endpoint; yasqe.options.sparql.endpoint = backendAddress + '/executeSparqlQuery'; cm.options.sparql.requestMethod = 'GET'; cm.options.sparql.args = [{ name: 'sparqlQuery', value: yasqe.getValue() }, { name: 'sparqlEndPoint', value: endPointSelected }, { name: 'selectType', value: yasqe.options.sparql.acceptHeaderSelect.replace('+', '%2B') }, { name: 'graphType', value: yasqe.options.sparql.acceptHeaderGraph.replace('+', '%2B') }]; return originalExecuteQuery(cm, {}); }

Request header sent:

Accept:/ Accept-Encoding:gzip, deflate, br Accept-Language:it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4 Access-Control-Request-Headers:0 Access-Control-Request-Method:GET Connection:keep-alive Host:localhost:8080 Origin:http://172.31.43.140:8081 Referer:http://172.31.43.140:8081/ User-Agent:Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.3

Expected header:

Accept:/ Accept-Encoding:gzip, deflate, br Accept-Language:it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4 Connection:keep-alive Content-Type:application/x-www-form-urlencoded Cookie:JSESSIONID=BCEB61C8AE230C13DB7CE162A6EC30C8 Host:localhost:8080 Origin:http://172.31.43.140:8081 Referer:http://172.31.43.140:8081/ User-Agent:Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36

Thank you in advance.

marcoromano91 commented 7 years ago

I have solved the issue. Same issue found it: https://github.com/OpenTriply/YASGUI.YASQE/issues/94