File tree Expand file tree Collapse file tree 3 files changed +5
-13
lines changed Expand file tree Collapse file tree 3 files changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ export class FormDataEncoder {
66
66
*
67
67
* const encoder = new Encoder(fd)
68
68
*/
69
- constructor ( form : FormDataLike , boundary : string = createBoundary ( 16 ) ) {
69
+ constructor ( form : FormDataLike , boundary : string = createBoundary ( ) ) {
70
70
if ( ! isFormData ( form ) ) {
71
71
throw new TypeError ( "Expected first argument to be a FormData instance." )
72
72
}
Original file line number Diff line number Diff line change @@ -3,20 +3,13 @@ import test from "ava"
3
3
import createBoundary from "./createBoundary"
4
4
5
5
test ( "Returns a string" , t => {
6
- const actual = createBoundary ( 16 )
6
+ const actual = createBoundary ( )
7
7
8
8
t . is ( typeof actual , "string" )
9
9
} )
10
10
11
- test ( "Returns a string of given length" , t => {
12
- const expected = 24
13
- const actual = createBoundary ( expected )
14
-
15
- t . is ( actual . length , expected )
16
- } )
17
-
18
11
test ( "Returns a string that passes regex of valid range" , t => {
19
- const actual = createBoundary ( 16 )
12
+ const actual = createBoundary ( )
20
13
21
14
t . regex ( actual , / ^ [ a - z A - Z 0 - 9 ' _ - ] + $ / )
22
15
} )
Original file line number Diff line number Diff line change @@ -3,10 +3,9 @@ const alphabet
3
3
4
4
/**
5
5
* Generates a boundary string for FormData encoder.
6
- *
7
- * @param size The size of the resulting string
8
6
*/
9
- function createBoundary ( size : number ) : string {
7
+ function createBoundary ( ) : string {
8
+ let size = 16
10
9
let res = ""
11
10
12
11
while ( size -- ) {
You can’t perform that action at this time.
0 commit comments