runabol / piper

piper - a distributed workflow engine
Apache License 2.0
487 stars 86 forks source link

Incorrect HTTP status code (500) #13

Closed ccamel closed 6 years ago

ccamel commented 6 years ago

The HTTP status code returned by the API is incorrect in some cases.

For instance, when launching a pipeline with a bad parameter:

> curl -v -s -X POST -H Content-Type:application/json -d '{"pipelineId":"demo/hello","inputs":{"badprop":"Joe Jones"}}' http://localhost:8080/jobs

I got:

< HTTP/1.1 500 
< X-Application-Context: application
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
< Date: Tue, 12 Jun 2018 10:17:03 GMT
< Connection: close
< 
* Closing connection 0
{"timestamp":"2018-06-12T10:17:03.794+0000","status":500,"error":"Internal Server Error","exception":"java.lang.IllegalArgumentException","message":"Missing required param: yourName","path":"/jobs"}⏎          

I would expect to have a 400 error code instead.

400 Bad Request: The request cannot be fulfilled due to bad syntax.

runabol commented 6 years ago

Good catch. Thanks. Fixed now.