HTTP Workflow status code

Hi,
I created a workflow with “HTTP request” action and compare strings operator after that to look for HTTP status code .

Though our API response returns 202 as a status code, the workflow does not consider that as a true condition and it goes to a false condition. ($.hTTPRequest.statusCode = 202). When I change the compare strings to ($.hTTPRequest.body = Accepted), it works.

I believe there is some issue with hTTPRequest.statusCode and you can see the values of the response in the below screenshot.

“result”:{“body”:“Accepted”,“headers”:null,“responseTime”:“0.033403 seconds”,“statusCode”:202} (Why is 202 not in double quotation marks?)

I have included the header Accept:application/json


The statusCode is an integer per the HTTP RFC. Rather than use Compare Strings, try using Compare Numbers to check the value of the statusCode.

I tested using compare numbers as well. Same issue.

I have verified that this is a bug. The value you provide in Value 2 gets converted to a string in the script, which will result in a False value every time because you can’t compare a number with a string. I have opened a bug ticket for engineering to resolve this. In the meantime, you can fix this issue by downloading the workflow script and manually updating Value 2 to be the integer representation of 202.

For example, here is a snippet of my workflow script where Value 2 is saved as a string.

{
	"name": "Test Comparison 2",
	"description": "",
	"modified": "2022-08-23T16:05:27.522649778Z",
	"definition": {
		"start": "HTTP Request",
		"steps": {
			"Compare Numbers": {
				"choiceList": [
					{
						"comparator": "NumericEquals",
						"nextStep": "success",
						"variableA.$": "$.hTTPRequest.statusCode",
						"variableB": "200"
					}
				],
				"defaultStep": "failure",
				"type": "choice"
			},

To fix this, modify *VariableB to be an integer and upload your script.

{
	"name": "Test Comparison 2",
	"description": "",
	"modified": "2022-08-23T16:05:27.522649778Z",
	"definition": {
		"start": "HTTP Request",
		"steps": {
			"Compare Numbers": {
				"choiceList": [
					{
						"comparator": "NumericEquals",
						"nextStep": "success",
						"variableA.$": "$.hTTPRequest.statusCode",
						"variableB": 200
					}
				],
				"defaultStep": "failure",
				"type": "choice"
			},

@colin_mckibben Thanks for quick response.

Can you inform us when the bug is fixed?

1 Like

This bug should now be fixed. Please let us know if you encounter any more issues with it.