DSP doesn't propagate http error code from external API

I’m getting unexpected, or undocumented behaviour from the DSP proxying an external API. The positive case works as expected, the external api’s http code 200 is passed through along with the response json payload.
However, when the external service generates an http 400 error response, the DSP curiously returns http code 200 OK along with the payload (if json) or null if a non-marked up message is provided. Is this a bug, or is there a documented approach to error pass-through from the proxied external service?
We’re using DreamFactory 1.8.2.

External REST service (zato ESB) correct response to an invalid parameter—

HTTP/1.1 400 Bad Request
Server: Zato
...
Content-Type: application/json

{"error": [{"message": "Not a valid MSISDN", "code": 400}]}

Proxied response from DSP (note changed http code) —

HTTP/1.1 200 OK
Date: Fri, 02 Jan 2015 18:52:06 GMT
Server: Apache/2.4.6
...
Content-Type: application/json; charset=utf-8

{"error":[{"message":"Not a valid MSISDN","code":400}]}

Error codes should be passed through the DSP (flavors of 200 currently are not; e.g., 201). Is this Zato service public? Can you give me an example call that behaves this way so that I may test?

Same this is happening for me.

I have the path block like this:

{
	"paths": {
		"/endpoint": {
			"post": {
				"tags": [
					"endpoint"
				],
				"summary": "Example endpoint path",
				"parameters": [
					{
						"name": "params",
						"description": "Example param",
						"type": "string",
						"in": "query",
						"required": true
					}
				],
				"responses": {
					"200": {
						"description": "Success",
						"schema": {
							"$ref": "#/definitions/SuccessModel"
						}
					},
					"default": {
						"description": "Unexpected error",
						"schema": {
							"$ref": "#/definitions/ErrorModel"
						}
					}
				},
				"description": "Example endpoint path"
			}
		}
	},
	"definitions": {
		"SuccessModel": {
			"type": "object",
			"required": [
				"message",
				"code"
			],
			"properties": {
				"message": {
					"type": "string"
				},
				"code": {
					"type": "integer",
					"format": "int32",
					"minimum": 100,
					"maximum": 600
				}
			}
		},
		"ErrorModel": {
			"type": "object",
			"required": [
				"message",
				"code"
			],
			"properties": {
				"message": {
					"type": "string"
				},
				"code": {
					"type": "integer",
					"format": "int32",
					"minimum": 100,
					"maximum": 600
				}
			}
		}
	}
}

My external web service is returning 301 status code with Not Found message. But Dreamfactory is returning as the following response:

"error": {
    "context": null,
    "message": "{"message":["Not Found"],"code":301}",
    "code": 301,
    "trace": [
      "0 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Components/RestHandler.php(185): DreamFactory\\Core\\Rws\\Services\\RemoteWeb->processRequest()",

Any help would be appreciated. Thanks.

  • Imthiaj