OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
6 | 6 |
7 /** | 7 /** |
8 * A client-side XHR request for getting data from a URL, | 8 * A client-side XHR request for getting data from a URL, |
9 * formally known as XMLHttpRequest. | 9 * formally known as XMLHttpRequest. |
10 * | 10 * |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 var value = header.substring(splitIdx + 2); | 377 var value = header.substring(splitIdx + 2); |
378 if (headers.containsKey(key)) { | 378 if (headers.containsKey(key)) { |
379 headers[key] = '${headers[key]}, $value'; | 379 headers[key] = '${headers[key]}, $value'; |
380 } else { | 380 } else { |
381 headers[key] = value; | 381 headers[key] = value; |
382 } | 382 } |
383 } | 383 } |
384 return headers; | 384 return headers; |
385 } | 385 } |
386 | 386 |
387 /** | |
388 * Specify the desired `url`, and `method` to use in making the request. | |
389 * | |
390 * By default the request is done asyncronously, with no user or password | |
391 * authentication information. If `async` is false, the request will be send | |
392 * synchronously. | |
393 * | |
394 * Calling `open` again on a currently active request is equivalent to | |
395 * calling `abort`. | |
396 * | |
397 * Note: Most simple HTTP requests can be accomplished using the [getString], | |
398 * [request], [requestCrossOrigin], or [postFormData] methods. Use of this | |
399 * `open` method is intended only for more complext HTTP requests where | |
400 * finer-grained control is needed. | |
401 */ | |
402 @DomName('XMLHttpRequest.open') | |
403 @DocsEditable() | |
404 $if JSINTEROP | |
405 void open(String method, String url, {bool async, String user, String password
}) { | |
406 if (async == null && user == null && password == null) { | |
407 _blink.BlinkXMLHttpRequest.instance.open_Callback_2_(unwrap_jso(this), met
hod, url); | |
408 } else { | |
409 _blink.BlinkXMLHttpRequest.instance.open_Callback_5_(unwrap_jso(this), met
hod, url, async, user, password); | |
410 } | |
411 } | |
412 $else | |
413 void open(String method, String url, {bool async, String user, String password
}) native; | |
414 $endif | |
415 | |
416 $!MEMBERS | 387 $!MEMBERS |
417 } | 388 } |
OLD | NEW |