Open shawnhind opened 4 years ago
Is this a public endpoint for which you can share the yasgui query link? If not, could you copy the request yasgui sends (copy as curl from developer tab), execute it with a verbose flag (curl -v) and post the output?
@LaurensRietveld okay this helped me discover the problem when I was looking at the output from this.
Seems that my server wasn't setting the Content-Type header in its response so I've fixed that now. Oddly enough not having the header set worked fine with the previous versions of Yasgui so I never realized it wasn't set.
Thanks for the help!
I'll leave it open anyway. The logic should have stayed the same (there is some logic that tries to auto-detect the response when it doesn't recognize the content type)
@shawnhind I'm can't manage to reproduce this. When executing a query on an endpoint that returns your example sparql response, and no response content type (see below for simple implementation), it seems to work fine. If you have more information on how to reproduce this, let me know!
Dummy sparql endpoint:
const Koa = require('koa'); // koa framework
const router = require('koa-router')(); // router middleware for koa
const cors = require('@koa/cors');
const app = new Koa();
app.use(cors())
router.post('/', async function(ctx, next) {
ctx.body = {
"head" : {
"vars" : [ "sub", "pred", "obj" ]
},
"results" : {
"bindings" : [ {
"sub" : {
"type" : "uri",
"value" : "https://www.sometesturi.com/"
},
"pred" : {
"type" : "uri",
"value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
},
"obj" : {
"type" : "uri",
"value" : "http://schema.org/Thing"
}
} ]
}
}
ctx.response.remove('content-type');
});
router.get('/', async function(ctx, next) {
ctx.body = {
"head" : {
"vars" : [ "sub", "pred", "obj" ]
},
"results" : {
"bindings" : [ {
"sub" : {
"type" : "uri",
"value" : "https://www.sometesturi.com/"
},
"pred" : {
"type" : "uri",
"value" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
},
"obj" : {
"type" : "uri",
"value" : "http://schema.org/Thing"
}
} ]
}
}
ctx.response.remove('content-type');
});
app.use(router.routes());
app.listen(3001);
console.log('listening on 3001');
@LaurensRietveld I actually think my server was returning it with Content-Type: application/x-www-form-urlencoded as a default if none was specified
great, that was it, managed to reproduce :+1:
My query endpoint is returning a response in application/sparql-results+json format. This is the same format we used for the previous version of YASGUI/YASR and it worked.
However, now when we return this format it's just displaying the raw results in YASR rather than formatting it as a table. I also tried changing the format to application/sparql-results+xml and it also just dumped the XML into where the table should be.
Here's what an example response from our server looks like