File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,12 @@ export class RequestInitGenerator {
1313 public readonly mode : "same-origin" | "navigate" | "no-cors" | "cors" | undefined ;
1414 public readonly xRequestedWith : string ;
1515
16- constructor ( opts : RequestInitGeneratorOpts = {
17- credentials : "include" ,
18- csrfFieldName : "csrf-token" ,
19- mode : "same-origin" ,
20- xRequestedWith : "XMLHttpRequest" ,
21- } ) {
16+ constructor ( opts : Partial < RequestInitGeneratorOpts > = { } ) {
2217 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" ;
2722 }
2823
2924 public authenticityHeader ( options = { } ) : Record < string , string > {
You can’t perform that action at this time.
0 commit comments