You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by "Chamila de Alwis (JIRA)" <ji...@apache.org> on 2015/04/17 21:20:59 UTC

[jira] [Resolved] (STRATOS-1277) Wrong HTTP status code returned for Conflict - adding a deployment/application policy

     [ https://issues.apache.org/jira/browse/STRATOS-1277?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chamila de Alwis resolved STRATOS-1277.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 4.1.0 RC1

Fixed in 477c366bbdd3541b48a84ef72104fb392c74c190

> Wrong HTTP status code returned for Conflict - adding a deployment/application policy
> -------------------------------------------------------------------------------------
>
>                 Key: STRATOS-1277
>                 URL: https://issues.apache.org/jira/browse/STRATOS-1277
>             Project: Stratos
>          Issue Type: Bug
>          Components: REST API
>    Affects Versions: 4.1.0 Alpha
>            Reporter: Shavindri Dissanayake
>            Priority: Minor
>             Fix For: 4.1.0 RC1
>
>
> 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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)