Prechádzať zdrojové kódy

Accept non-multipart SPARQL query requests.

Stefano Cossu 7 rokov pred
rodič
commit
f3605e91c4
1 zmenil súbory, kde vykonal 6 pridanie a 2 odobranie
  1. 6 2
      lakesuperior/endpoints/query.py

+ 6 - 2
lakesuperior/endpoints/query.py

@@ -55,9 +55,13 @@ def sparql():
     if request.method == 'GET':
         return render_template('sparql_query.html', nsm=nsm)
     else:
-        logger.debug('Query: {}'.format(request.form['query']))
+        if request.mimetype == 'multipart/form-data':
+            qstr = request.form['query']
+        else:
+            qstr = stream.read()
+        logger.debug('Query: {}'.format(qstr))
         with TxnManager(rdf_store) as txn:
-            qres = query_api.sparql_query(request.form['query'])
+            qres = query_api.sparql_query(qstr)
 
             match = request.accept_mimetypes.best_match(accept_mimetypes.keys())
             if match: