fix: omit explicit content type for FIR uploads
Deploy B9 / deploy (push) Successful in 4m11s

This commit is contained in:
fucheng
2026-11-02 15:48:32 +08:00
parent 6d952fa0fd
commit d09db8b723
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -423,7 +423,7 @@ export class LuxsinAPI {
? `/fir-device/${host}/${side}`
: `${this.baseUrl}/dev/info.cgi?action=fir&channel=${side}`;
const response = await this.timedFetch(url, {
method: 'POST', headers: { 'Content-Type': 'audio/wav' }, body: encodeDeviceFirWav(data),
method: 'POST', body: encodeDeviceFirWav(data),
});
if (!response.ok) {
let reason = '';
+2 -2
View File
@@ -29,7 +29,7 @@ test('actual API sends only raw left/right binary, never FIR settings',async()=>
const l=encodeFir(coefficients()),r=encodeFir(Array(8191).fill(-0.125));
await applyFir(new LuxsinAPI('192.168.9.127'),l,r);
assert.deepEqual(requests.map(r=>r.url),['http://192.168.9.127/dev/info.cgi?action=fir&channel=left','http://192.168.9.127/dev/info.cgi?action=fir&channel=right']);
for (const [index,b] of [[0,l],[1,r]]) {assert.equal(requests[index].init.method,'POST');assert.equal(requests[index].init.headers['Content-Type'],'audio/wav');assert.deepEqual(new Uint8Array(decodeFirWav(requests[index].init.body)),new Uint8Array(decodeFirWav(encodeDeviceFirWav(b))));}
for (const [index,b] of [[0,l],[1,r]]) {assert.equal(requests[index].init.method,'POST');assert.equal(new Headers(requests[index].init.headers).has('Content-Type'),false);assert.deepEqual(new Uint8Array(decodeFirWav(requests[index].init.body)),new Uint8Array(decodeFirWav(encodeDeviceFirWav(b))));}
});
test('manual 8192-tap bytes preserved, enable/disable setting contract',async()=>{
const requests=[];globalThis.fetch=async(url,init)=>{requests.push({url,init});return new Response('OK');};
@@ -149,7 +149,7 @@ test('legacy 44.1 kHz room becomes device-compatible 48 kHz WAV', async () => {
await applyFir(new LuxsinAPI('192.168.9.133'), left, right);
assert.equal(requests.length, 2);
for (const req of requests) {
assert.equal(req.headers['Content-Type'], 'audio/wav');
assert.equal(new Headers(req.headers).has('Content-Type'), false);
assert.equal(new DataView(req.body).getUint32(24, true), 48000);
assert.equal(req.body.byteLength, 32826);
const samples = new DataView(decodeFirWav(req.body));