Skip to content

Commit

Permalink
fix(http): use globalThis.TextEncoder when available (axios#6634)
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitriy Mozgovoy <[email protected]>
  • Loading branch information
kasperisager and DigitalBrainJS authored Nov 12, 2024
1 parent 7139ce9 commit df956d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/helpers/formDataToStream.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {TextEncoder} from 'util';
import util from 'util';
import {Readable} from 'stream';
import utils from "../utils.js";
import readBlob from "./readBlob.js";

const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';

const textEncoder = new TextEncoder();
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();

const CRLF = '\r\n';
const CRLF_BYTES = textEncoder.encode(CRLF);
Expand Down

0 comments on commit df956d1

Please sign in to comment.