file is correctly uploaded with htmx.ajax16ms ‣
this.server.respondWith('POST', '/test', function(xhr) {
should.equal(xhr.requestHeaders['Content-Type'], undefined)
const file = xhr.requestBody.get('file')
file.should.instanceOf(File)
file.name.should.equal('test.txt')
xhr.respond(200, {}, 'OK')
})
const div = make('<div hx-encoding="multipart/form-data"></div>')
htmx.ajax('POST', '/test', {
source: div,
values: {
file: new File(['Test'], 'test.txt', { type: 'text/plain' })
}
})
this.server.respond()
div.innerHTML.should.equal('OK')