File tree 1 file changed +5
-10
lines changed
1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,12 @@ export class RequestInitGenerator {
13
13
public readonly mode : "same-origin" | "navigate" | "no-cors" | "cors" | undefined ;
14
14
public readonly xRequestedWith : string ;
15
15
16
- constructor ( opts : RequestInitGeneratorOpts = {
17
- credentials : "include" ,
18
- csrfFieldName : "csrf-token" ,
19
- mode : "same-origin" ,
20
- xRequestedWith : "XMLHttpRequest" ,
21
- } ) {
16
+ constructor ( opts : Partial < RequestInitGeneratorOpts > = { } ) {
22
17
this . baseHeaders = opts . headers || { } ;
23
- this . csrfFieldName = opts . csrfFieldName ;
24
- this . credentials = opts . credentials ;
25
- this . mode = opts . mode ;
26
- this . xRequestedWith = opts . xRequestedWith ;
18
+ this . csrfFieldName = opts . csrfFieldName ?? "csrf-token" ;
19
+ this . credentials = opts . credentials ?? "include" ;
20
+ this . mode = opts . mode ?? "same-origin" ;
21
+ this . xRequestedWith = opts . xRequestedWith ?? "XMLHttpRequest" ;
27
22
}
28
23
29
24
public authenticityHeader ( options = { } ) : Record < string , string > {
You can’t perform that action at this time.
0 commit comments