2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00
Files
axios/test/unit/helpers/fromDataURI.js
T
Dmitriy Mozgovoy c30252f685 Added data URL support for node.js; (#4725)
* Added data URL support for node.js;
Added missed data URL protocol for the browser environment;
Optimized JSON parsing in the default response transformer;
Refactored project structure;
Added `cause` prop for AxiosError instance that refers to the original error if it was wrapped with `AxiosError.from` method;
Added fromDataURI helper;
Added test for handling data:url as an `arraybuffer|text|stream`;

* Added throwing of 405 HTTP error if the method is not GET;
2022-05-20 08:04:36 +02:00

13 lines
397 B
JavaScript

var assert = require('assert');
var fromDataURI = require('../../../lib/helpers/fromDataURI');
describe('helpers::fromDataURI', function () {
it('should return buffer from data uri', function () {
const buffer= Buffer.from('123');
const dataURI = 'data:application/octet-stream;base64,' + buffer.toString('base64');
assert.deepStrictEqual(fromDataURI(dataURI), buffer);
});
});