This is an automated email from the ASF dual-hosted git repository.

nic-6443 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 6fe1cf0fd test: fix standalone content type narrowing (#13459)
6fe1cf0fd is described below

commit 6fe1cf0fd2c544bb0f96b0d8eec9c3b5ca2752a5
Author: Nic <[email protected]>
AuthorDate: Mon Jun 1 13:55:37 2026 +0800

    test: fix standalone content type narrowing (#13459)
---
 t/admin/standalone.spec.ts | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/t/admin/standalone.spec.ts b/t/admin/standalone.spec.ts
index 8433a1508..5a71c4122 100644
--- a/t/admin/standalone.spec.ts
+++ b/t/admin/standalone.spec.ts
@@ -181,12 +181,14 @@ const serviceWithInvalidUpstream = {
 
 let mockDigest = 1;
 
+const isYamlContentType = (contentType: unknown) =>
+  typeof contentType === 'string' && contentType.includes('application/yaml');
+
 describe('Admin - Standalone', () => {
   const client = axios.create(clientConfig);
   client.interceptors.response.use((response) => {
-    const contentType = response.headers['content-type'] || '';
     if (
-      contentType.includes('application/yaml') &&
+      isYamlContentType(response.headers['content-type']) &&
       typeof response.data === 'string' &&
       response.config.responseType !== 'text'
     )
@@ -648,9 +650,8 @@ describe('Admin - Standalone', () => {
 describe('Validate API - Standalone', () => {
   const client = axios.create(clientConfig);
   client.interceptors.response.use((response) => {
-    const contentType = response.headers['content-type'] || '';
     if (
-      contentType.includes('application/yaml') &&
+      isYamlContentType(response.headers['content-type']) &&
       typeof response.data === 'string' &&
       response.config.responseType !== 'text'
     )

Reply via email to