Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-7964

Malformed JSON should return HTTP 400, not HTTP 500

    XMLWordPrintable

Details

    Description

      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://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

      Attachments

        Issue Links

          Activity

            People

              crolf Christian
              4c762d6af390 Corey Steele
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: