Uploaded image for project: 'Stratos'
  1. Stratos
  2. STRATOS-1277

Wrong HTTP status code returned for Conflict - adding a deployment/application policy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 4.1.0 Alpha
    • 4.1.0 RC3
    • REST API
    • None

    Description

      Normally the 409 HTTP status code should be returned if a resources that is being added is already in the system. However, when executing the commands to add a deployment policy and application policy the respective output is shown : [1] and [2] where the code returned is 400.

      Further noticed a minor improvement in the error message given [3].

      [1]
      This is not a bad request, this is given because the deployment policy I am trying to add is already in the system. When it's deleted and the same command is executed then it gets added to the system, thus this should be conflict error.

      curl -X POST -H "Content-Type: application/json" -d @'deployment-policies/deployment-policy-1.json' -k -v -u admin:admin https://localhost:9443/api/deploymentPolicies

      • Hostname was NOT found in DNS cache
      • Trying ::1...
      • Connected to localhost (::1) port 9443 (#0)
      • TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
      • Server certificate: localhost
      • Server auth using Basic with user 'admin'
        > POST /api/deploymentPolicies HTTP/1.1
        > Authorization: Basic YWRtaW46YWRtaW4=
        > User-Agent: curl/7.37.1
        > Host: localhost:9443
        > Accept: /
        > Content-Type: application/json
        > Content-Length: 287
        >
      • upload completely sent off: 287 out of 287 bytes
        < HTTP/1.1 400 Bad Request
        < Date: Mon, 23 Mar 2015 08:37:22 GMT
        < Content-Type: application/json
        < Transfer-Encoding: chunked
        < Connection: close
      • Server WSO2 Carbon Server is not blacklisted
        < Server: WSO2 Carbon Server
        <
      • Closing connection 0 {"errorCode":400,"errorMessage":"Could not add deployment policy"}

      [2]
      curl -X POST -H "Content-Type: application/json" -d @'application-policies/application-policy-1.json' -k -v -u admin:admin https://localhost:9443/api/applicationPolicies

      • Hostname was NOT found in DNS cache
      • Trying ::1...
      • Connected to localhost (::1) port 9443 (#0)
      • TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
      • Server certificate: localhost
      • Server auth using Basic with user 'admin'
        > POST /api/applicationPolicies HTTP/1.1
        > Authorization: Basic YWRtaW46YWRtaW4=
        > User-Agent: curl/7.37.1
        > Host: localhost:9443
        > Accept: /
        > Content-Type: application/json
        > Content-Length: 307
        >
      • upload completely sent off: 307 out of 307 bytes
        < HTTP/1.1 400 Bad Request
        < Date: Mon, 23 Mar 2015 08:40:34 GMT
        < Content-Type: application/json
        < Transfer-Encoding: chunked
        < Connection: close
      • Server WSO2 Carbon Server is not blacklisted
        < Server: WSO2 Carbon Server
        <
      • Closing connection 0 {"errorCode":400,"errorMessage":"Could not add application policyApplication policy already exists : application-policy-1"}

      [3]
      currently what we have: Could not add application policyApplication policy already exists : application-policy-1

      suggested (with spacing): Could not add application policy. Application policy already exists : application-policy-1

      Attachments

        Activity

          People

            Unassigned Unassigned
            shavindri Shavindri Dissanayake
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: