Malformed JSON should return HTTP 400, not HTTP 500

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Duplicate
    • None
    • Component/s: None
    • None

      Using the Stash REST API and sending POST or PUT requests, if the JSON payload is not formated correctly the Stash server returns HTTP 500 instead of HTTP 400.

      • STEPS TO REPRODUCE
        curl -H "Authorization: Basic ..." -H "Content-Type: application/json" -X PUT -d ' " {hook-url-0" : "some-url"}

        ' 'https://stash.example.com/rest/api/1.0/projects/

        {projectKey}

        /repos/

        {repositorySlug}

        /settings/hooks/

        {hookKey}

        /enabled

      Note that the payload is not correct JSON.

      • RESULTS
        Stash returns
        HTTP/1.1 500 Internal Server Error
        {
        "errors": [ { "context": null, "exceptionName": null, "message": "An error occurred while processing the request. Check the server logs for more information." }

        ]
        }

      Stash should return,
      400 Bad Request

            Assignee:
            Bryan Turner (Inactive)
            Reporter:
            Corey Steele
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: