@@ -410,6 +410,8 @@ class Http {
410
410
* - headers: Map of strings or functions which return strings representing
411
411
* HTTP headers to send to the server. If the return value of a function
412
412
* is null, the header will not be sent.
413
+ * - withCredentials: True if cross-site requests should use credentials such as cookies or
414
+ * authorization headers; false otherwise. If not specified, defaults to false.
413
415
* - xsrfHeaderName: TBI
414
416
* - xsrfCookieName: TBI
415
417
* - interceptors: Either a [HttpInterceptor] or a [HttpInterceptors]
@@ -422,6 +424,7 @@ class Http {
422
424
data,
423
425
Map <String , dynamic > params,
424
426
Map <String , dynamic > headers,
427
+ bool withCredentials: false ,
425
428
xsrfHeaderName,
426
429
xsrfCookieName,
427
430
interceptors,
@@ -481,7 +484,8 @@ class Http {
481
484
var result = _backend.request (url,
482
485
method: method,
483
486
requestHeaders: config.headers,
484
- sendData: config.data).then ((dom.HttpRequest value) {
487
+ sendData: config.data,
488
+ withCredentials: withCredentials).then ((dom.HttpRequest value) {
485
489
// TODO: Uncomment after apps migrate off of this class.
486
490
// assert(value.status >= 200 && value.status < 300);
487
491
@@ -535,15 +539,16 @@ class Http {
535
539
String data,
536
540
Map <String , dynamic > params,
537
541
Map <String , String > headers,
542
+ bool withCredentials: false ,
538
543
xsrfHeaderName,
539
544
xsrfCookieName,
540
545
interceptors,
541
546
cache,
542
547
timeout
543
- }) => call (method: 'GET' , url: url, data: data, params: params,
544
- headers : headers , xsrfHeaderName: xsrfHeaderName,
545
- xsrfCookieName: xsrfCookieName, interceptors: interceptors,
546
- cache : cache, timeout: timeout);
548
+ }) => call (method: 'GET' , url: url, data: data, params: params, headers : headers,
549
+ withCredentials : withCredentials , xsrfHeaderName: xsrfHeaderName,
550
+ xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache : cache,
551
+ timeout: timeout);
547
552
548
553
/**
549
554
* Shortcut method for DELETE requests. See [call] for a complete description
@@ -553,15 +558,16 @@ class Http {
553
558
String data,
554
559
Map <String , dynamic > params,
555
560
Map <String , String > headers,
561
+ bool withCredentials: false ,
556
562
xsrfHeaderName,
557
563
xsrfCookieName,
558
564
interceptors,
559
565
cache,
560
566
timeout
561
- }) => call (method: 'DELETE' , url: url, data: data, params: params,
562
- headers : headers , xsrfHeaderName: xsrfHeaderName,
563
- xsrfCookieName: xsrfCookieName, interceptors: interceptors,
564
- cache : cache, timeout: timeout);
567
+ }) => call (method: 'DELETE' , url: url, data: data, params: params, headers : headers,
568
+ withCredentials : withCredentials , xsrfHeaderName: xsrfHeaderName,
569
+ xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache : cache,
570
+ timeout: timeout);
565
571
566
572
/**
567
573
* Shortcut method for HEAD requests. See [call] for a complete description
@@ -571,15 +577,16 @@ class Http {
571
577
String data,
572
578
Map <String , dynamic > params,
573
579
Map <String , String > headers,
580
+ bool withCredentials: false ,
574
581
xsrfHeaderName,
575
582
xsrfCookieName,
576
583
interceptors,
577
584
cache,
578
585
timeout
579
- }) => call (method: 'HEAD' , url: url, data: data, params: params,
580
- headers : headers , xsrfHeaderName: xsrfHeaderName,
581
- xsrfCookieName: xsrfCookieName, interceptors: interceptors,
582
- cache : cache, timeout: timeout);
586
+ }) => call (method: 'HEAD' , url: url, data: data, params: params, headers : headers,
587
+ withCredentials : withCredentials , xsrfHeaderName: xsrfHeaderName,
588
+ xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache : cache,
589
+ timeout: timeout);
583
590
584
591
/**
585
592
* Shortcut method for PUT requests. See [call] for a complete description
@@ -588,15 +595,16 @@ class Http {
588
595
async .Future <HttpResponse > put (String url, String data, {
589
596
Map <String , dynamic > params,
590
597
Map <String , String > headers,
598
+ bool withCredentials: false ,
591
599
xsrfHeaderName,
592
600
xsrfCookieName,
593
601
interceptors,
594
602
cache,
595
603
timeout
596
- }) => call (method: 'PUT' , url: url, data: data, params: params,
597
- headers : headers , xsrfHeaderName: xsrfHeaderName,
598
- xsrfCookieName: xsrfCookieName, interceptors: interceptors,
599
- cache : cache, timeout: timeout);
604
+ }) => call (method: 'PUT' , url: url, data: data, params: params, headers : headers,
605
+ withCredentials : withCredentials , xsrfHeaderName: xsrfHeaderName,
606
+ xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache : cache,
607
+ timeout: timeout);
600
608
601
609
/**
602
610
* Shortcut method for POST requests. See [call] for a complete description
@@ -605,15 +613,16 @@ class Http {
605
613
async .Future <HttpResponse > post (String url, String data, {
606
614
Map <String , dynamic > params,
607
615
Map <String , String > headers,
616
+ bool withCredentials: false ,
608
617
xsrfHeaderName,
609
618
xsrfCookieName,
610
619
interceptors,
611
620
cache,
612
621
timeout
613
- }) => call (method: 'POST' , url: url, data: data, params: params,
614
- headers : headers , xsrfHeaderName: xsrfHeaderName,
615
- xsrfCookieName: xsrfCookieName, interceptors: interceptors,
616
- cache : cache, timeout: timeout);
622
+ }) => call (method: 'POST' , url: url, data: data, params: params, headers : headers,
623
+ withCredentials : withCredentials , xsrfHeaderName: xsrfHeaderName,
624
+ xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache : cache,
625
+ timeout: timeout);
617
626
618
627
/**
619
628
* Shortcut method for JSONP requests. See [call] for a complete description
@@ -623,15 +632,16 @@ class Http {
623
632
String data,
624
633
Map <String , dynamic > params,
625
634
Map <String , String > headers,
635
+ bool withCredentials: false ,
626
636
xsrfHeaderName,
627
637
xsrfCookieName,
628
638
interceptors,
629
639
cache,
630
640
timeout
631
- }) => call (method: 'JSONP' , url: url, data: data, params: params,
632
- headers : headers , xsrfHeaderName: xsrfHeaderName,
633
- xsrfCookieName: xsrfCookieName, interceptors: interceptors,
634
- cache : cache, timeout: timeout);
641
+ }) => call (method: 'JSONP' , url: url, data: data, params: params, headers : headers,
642
+ withCredentials : withCredentials , xsrfHeaderName: xsrfHeaderName,
643
+ xsrfCookieName: xsrfCookieName, interceptors: interceptors, cache : cache,
644
+ timeout: timeout);
635
645
636
646
/**
637
647
* Parse raw headers into key-value object
0 commit comments