Skip to content

Commit bb22179

Browse files
fix NamespacesExampleTest: Refactor headerValueEncode to use toText for string conversion (#2967)
* Update XPath expression to ensure string conversion for `id` header * Refactor `headerValueEncode` to use `toText` for string conversion and simplify XPath in proxies.xml
1 parent b3a0738 commit bb22179

6 files changed

Lines changed: 73 additions & 2 deletions

File tree

core/src/main/java/com/predic8/membrane/core/interceptor/llmgateway/NullPolicies.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2026 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.interceptor.llmgateway;
216

317
import com.predic8.membrane.core.exchange.Exchange;

core/src/main/java/com/predic8/membrane/core/interceptor/llmgateway/Policies.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2026 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.interceptor.llmgateway;
216

317
import com.predic8.membrane.core.exchange.Exchange;

core/src/main/java/com/predic8/membrane/core/interceptor/llmgateway/SystemPrompt.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2026 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.interceptor.llmgateway;
216

317
import com.predic8.membrane.annot.MCAttribute;

core/src/main/java/com/predic8/membrane/core/util/text/SerializationUtil.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import static com.predic8.membrane.core.http.MimeType.*;
2222
import static com.predic8.membrane.core.util.text.SerializationFunction.*;
23+
import static com.predic8.membrane.core.util.text.ToTextSerializer.toText;
2324
import static java.lang.Character.*;
2425
import static java.nio.charset.StandardCharsets.*;
2526

@@ -150,7 +151,7 @@ public static String pathEncode(Object value) {
150151
public static String headerValueEncode(Object value) {
151152
if (value == null) return "";
152153

153-
String s = value.toString();
154+
String s = toText(value);
154155
var out = new StringBuilder(s.length());
155156

156157
for (int i = 0; i < s.length(); i++) {
@@ -165,4 +166,4 @@ public static String headerValueEncode(Object value) {
165166

166167
return out.toString();
167168
}
168-
}
169+
}

core/src/test/java/com/predic8/membrane/core/interceptor/llmgateway/provider/AbstractLLMRequestTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2026 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.interceptor.llmgateway.provider;
216

317
import com.predic8.membrane.core.exchange.Exchange;

core/src/test/java/com/predic8/membrane/core/lang/ScriptingUtilsTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/* Copyright 2026 predic8 GmbH, www.predic8.com
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License. */
14+
115
package com.predic8.membrane.core.lang;
216

317
import com.predic8.membrane.core.router.DefaultRouter;

0 commit comments

Comments
 (0)