fix: do not manually parse content-type (#20538)

This commit is contained in:
Cheng Zhao 2019-10-12 03:54:50 +09:00 committed by John Kleinschmidt
parent 67642312f4
commit 1b2c6a33b3
2 changed files with 14 additions and 3 deletions

View file

@ -469,6 +469,18 @@ describe('protocol module', () => {
expect(r.data).to.have.property('value').that.is.equal(1)
})
it('can set content-type with charset', async () => {
await interceptStringProtocol('http', (request, callback) => {
callback({
mimeType: 'application/json; charset=UTF-8',
data: '{"value": 1}'
})
})
const r = await ajax('http://fake-host')
expect(r.data).to.be.an('object')
expect(r.data).to.have.property('value').that.is.equal(1)
})
it('can receive post data', async () => {
await interceptStringProtocol('http', (request, callback) => {
const uploadData = request.uploadData[0].bytes.toString()