Skip to content

Fix Sandbox API Key requests returning Production Response for API Products #13153

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ private void setApiProductVelocityContext(APIProduct apiProduct, VelocityContext
} else {
context.put("apiIsOauthProtected", Boolean.FALSE);
}
// if API is secured with api_Key
Copy link
Preview

Copilot AI Jun 20, 2025

Choose a reason for hiding this comment

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

[nitpick] You can simplify these blocks by directly putting the boolean expression into the context. For example: context.put("apiIsApiKeyProtected", apiSecurity != null && apiSecurity.contains(APIConstants.API_SECURITY_API_KEY)); This reduces verbosity and improves readability.

Copilot uses AI. Check for mistakes.

if (apiSecurity != null && apiSecurity.contains(APIConstants.API_SECURITY_API_KEY)) {
context.put("apiIsApiKeyProtected", Boolean.TRUE);
} else {
context.put("apiIsApiKeyProtected", Boolean.FALSE);
}
// if API is secured with basic_auth
if (apiSecurity != null && apiSecurity.contains(APIConstants.API_SECURITY_BASIC_AUTH)) {
context.put("apiIsBasicAuthProtected", Boolean.TRUE);
} else {
context.put("apiIsBasicAuthProtected", Boolean.FALSE);
}
if (apiProduct.isEnabledSchemaValidation()) {
context.put("enableSchemaValidation", Boolean.TRUE);
} else {
Expand Down
Loading