Skip to content

Commit 8793afe

Browse files
committed
Remove redundant comment about query param validation (nginx#497)
Since 52fab05, NKG ensures query param names and values are not empty. This makes the comment redundant. "Check for an improperly constructed query parameter match" is enough.
1 parent 9649fb6 commit 8793afe

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

internal/nginx/modules/src/httpmatches.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,13 @@ function headersMatch(requestHeaders, headers) {
159159
function paramsMatch(requestParams, params) {
160160
for (let i = 0; i < params.length; i++) {
161161
let p = params[i];
162-
// We store query parameter matches as strings with the format "key=value"; however, there may be more than one instance of "=" in the string.
162+
// We store query parameter matches as strings with the format "key=value"; however, there may be more than one
163+
// instance of "=" in the string.
163164
// To recover the key and value, we need to find the first occurrence of "=" in the string.
164165
const idx = params[i].indexOf('=');
165166
// Check for an improperly constructed query parameter match. There are three possible error cases:
166167
// (1) if the index is -1, then there are no "=" in the string (e.g. "keyvalue")
167168
// (2) if the index is 0, then there is no value in the string (e.g. "key=").
168-
// NOTE: While query parameter values are permitted to be empty, the Gateway API Spec forces the value to be a non-empty string.
169-
// https://github.com/kubernetes-sigs/gateway-api/blob/e9e04e498c566021c9d30ce4dbe0863894c7d7e1/apis/v1beta1/httproute_types.go#L419
170169
// (3) if the index is equal to length -1, then there is no key in the string (e.g. "=value").
171170
if (idx === -1 || (idx === 0) | (idx === p.length - 1)) {
172171
throw Error(`invalid query parameter: ${p}`);

0 commit comments

Comments
 (0)