summaryrefslogtreecommitdiff
path: root/cli/http_util.rs
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2021-01-08 03:08:51 +0100
committerGitHub <noreply@github.com>2021-01-08 03:08:51 +0100
commita44349dfdfecacdd4ccd343a984b05abb728bf88 (patch)
tree690b5047cc54d62ce27013ebb199e9bdc7de0937 /cli/http_util.rs
parente61e81eb57351782862aa50775ce4348f10b1856 (diff)
feat: denort binary (#9041)
This commit adds new binary target called "denort". It is a "lite" version of "deno" binary that can only execute code embedded inside the binary itself. Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/http_util.rs')
-rw-r--r--cli/http_util.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/cli/http_util.rs b/cli/http_util.rs
index df2a7d3a2..a27928055 100644
--- a/cli/http_util.rs
+++ b/cli/http_util.rs
@@ -1,6 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use crate::version;
use deno_core::error::generic_error;
use deno_core::error::AnyError;
use deno_core::url::Url;
@@ -15,10 +14,6 @@ use deno_runtime::deno_fetch::reqwest::Client;
use deno_runtime::deno_fetch::reqwest::StatusCode;
use std::collections::HashMap;
-pub fn get_user_agent() -> String {
- format!("Deno/{}", version::deno())
-}
-
/// Create new instance of async reqwest::Client. This client supports
/// proxies and doesn't follow redirects.
pub fn create_http_client(
@@ -155,6 +150,7 @@ pub async fn fetch_once(
#[cfg(test)]
mod tests {
use super::*;
+ use crate::version;
use std::fs::read;
fn create_test_client(ca_data: Option<Vec<u8>>) -> Client {
@@ -313,7 +309,7 @@ mod tests {
Url::parse("https://localhost:5545/cli/tests/fixture.json").unwrap();
let client = create_http_client(
- get_user_agent(),
+ version::get_user_agent(),
Some(
read(
test_util::root_path()
@@ -345,7 +341,7 @@ mod tests {
)
.unwrap();
let client = create_http_client(
- get_user_agent(),
+ version::get_user_agent(),
Some(
read(
test_util::root_path()
@@ -376,7 +372,7 @@ mod tests {
let _http_server_guard = test_util::http_server();
let url = Url::parse("https://localhost:5545/etag_script.ts").unwrap();
let client = create_http_client(
- get_user_agent(),
+ version::get_user_agent(),
Some(
read(
test_util::root_path()
@@ -416,7 +412,7 @@ mod tests {
)
.unwrap();
let client = create_http_client(
- get_user_agent(),
+ version::get_user_agent(),
Some(
read(
test_util::root_path()