()
| 1178 | }; |
| 1179 | |
| 1180 | const testPostCors = async () => { |
| 1181 | if (usesJsonApi) return { success: false, cors: false }; |
| 1182 | const response = await withTimeout(url, { |
| 1183 | method: 'POST', mode: 'cors', |
| 1184 | headers: { 'Content-Type': 'application/dns-message', ...DNS_MESSAGE_HEADERS }, |
| 1185 | body: dnsQuery |
| 1186 | }); |
| 1187 | if (!response) return { success: false, cors: false }; |
| 1188 | return { success: response.ok, cors: response.type === 'cors' }; |
| 1189 | }; |
| 1190 | |
| 1191 | const [getCors, postCors, getNoCors] = await Promise.all([ |
| 1192 | testGet('cors'), testPostCors(), testGet('no-cors') |
no test coverage detected