Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-8836

/update should return BAD REQUEST when invalid JSON provided

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 6.0
    • Component/s: None
    • Labels:
      None

      Description

      When a user provides invalid JSON to the /update endpoint, the request fails with a 500 (INTERNAL SERVER ERROR). If the user looks at the response body, they'll see a message indicating that the provided JSON was invalid. However, going from the status code alone, the failure is indistinguishable from a true server-error. This is a bit misleading. It would be nice if Solr instead returned a 400 (BAD REQUEST) status code when it detects invalid arguments.

      Reproduction Steps:
      1.) bin/solr start -e cloud -noprompt
      2.) curl -i -l -k -X POST -H 'Content-Type: application/json' 'http://localhost:8983/solr/gettingstarted/update' --data-binary '}{'

        Attachments

        1. SOLR-8836.patch
          1 kB
          Jason Gerlowski
        2. SOLR-8836.patch
          3 kB
          Jason Gerlowski

          Activity

            People

            • Assignee:
              anshumg Anshum Gupta
              Reporter:
              gerlowskija Jason Gerlowski
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: