You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2020/07/02 23:09:13 UTC

[GitHub] [jena] kinow commented on a change in pull request #772: JENA-1934: Better error handling for bad HTML forms

kinow commented on a change in pull request #772:
URL: https://github.com/apache/jena/pull/772#discussion_r449303519



##########
File path: jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/Dispatcher.java
##########
@@ -373,11 +382,23 @@ public static Operation chooseOperation(HttpAction action) {
 
         // -- Any other queryString
         // Query string now unexpected.
+
         // Place for an extension point.
         boolean hasParams = request.getParameterMap().size() > 0;
         if ( hasParams ) {
+            // One nasty case:
+            // Bad HTML form (content-type  application/x-www-form-urlencoded), but body is not an HTML form.
+            //  map is one entry, and the key is all of the body,
+            if ( WebContent.contentTypeHTMLForm.equals(request.getContentType()) ) {
+                ServletOps.errorBadRequest("Malformed request: unrecognized HTML form request");
+                return null;
+            }

Review comment:
       I think I got hit by this when I was writing the Vue.js client. The default value was sending JSON, or some other value, not HTML form. I couldn't figure out what was wrong, so had to look at the browser requests in the old UI to understand what the server was expecting.

##########
File path: jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/server/EndpointSet.java
##########
@@ -104,7 +104,7 @@ private void resetSingle() {
     public Collection<Operation> operations() { return endpoints.keySet(); }
     
     /** Get the Endpoint for a singleton EndpointSet */
-    public Endpoint getOnly() {
+    public Endpoint getExactlyOne() {

Review comment:
       Much more descriptive! Thanks!




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org