Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5823 add responseStatusCode #6170

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
#5823 add responseStatusCode
  • Loading branch information
rogin committed Jun 22, 2023
commit 43878a108f90ffff6e8fd3e1096c0da59a3ab282
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ public Response send(ConnectorProperties connectorProperties, ConnectorMessage c
list.add(header.getValue());
}

connectorMessage.getConnectorMap().put("responseStatusCode", String.valueOf(statusCode));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my preference would be to leave it as an int rather than converting it to a String. It is a numerical value, after all.

It won't have the issue with velocity adding the .0 that @jonbartels alluded to because java auto-boxing will store it as a java.lang.Integer rather than a java.lang.Double as it would be if you put a JavaScript number into the map.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the statusCode should probably be left as an int.

Copy link
Collaborator

@pacmano1 pacmano1 May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well sure...would want to do response code comparisons by integer ranges anyway.

200s are OK
300s are redirects.
400s are errors
etc

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

connectorMessage.getConnectorMap().put("responseStatusLine", statusLine.toString());
connectorMessage.getConnectorMap().put("responseHeaders", new MessageHeaders(new CaseInsensitiveMap(headers)));

Expand Down