File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -477,19 +477,19 @@ namespace internal {
477
477
extern pure def backend(): String =
478
478
jsNode { "js-node" }
479
479
jsWeb { "js-web" }
480
+
481
+ extern pure def ifNode[R]{ thnNode: => R }{ thnWeb: => R }: R =
482
+ jsNode { thnNode() }
483
+ jsWeb { thnWeb() }
480
484
}
481
485
482
486
/// Make a HTTP(S) request on the backend-specific implementation,
483
487
/// then pass the response to the second block parameter to process.
484
488
///
485
489
/// The Request body is buffered, the response is streaming (as far
486
490
/// as the backend implementation allows).
487
- def request[R]{ body: => Unit / RequestBuilder }{ res: {ResponseReader} => R }: R / Exception[RequestError] = internal::backend() match {
488
- // TODO use a proper dispatch after #448 is resolved
489
- case "js-node" => jsNode::request{body}{res}
490
- case "js-web" => jsWeb::request{body}{res}
491
- case _ => <>
492
- }
491
+ def request[R]{ body: => Unit / RequestBuilder }{ res: {ResponseReader} => R }: R / Exception[RequestError] =
492
+ internal::ifNode{ jsNode::request{body}{res} }{ jsWeb::request{body}{res} }
493
493
494
494
// Simple API
495
495
// ----------
You can’t perform that action at this time.
0 commit comments