Repository: hatoo/oha (rust)

Issue:
incorrect header host value?
I tried using it like below, hoping to simulate the access to a service on my local machine. The service online is a service of xxx.com, so use the host header to simulate it.

```bash
oha -H "host:xxx.com" -z 30m "http://127.0.0.1:8000"
```

What is received on the server side is

```
Request {
  bodyUsed: false,
  headers: Headers {
  accept: "*/*",
  "accept-encoding": "gzip, compress, deflate, br",
  host: "127.0.0.1:8000, xxx.com",
  "user-agent": "oha/0.6.3"
},
  method: "GET",
  redirect: undefined,
  url: "http://127.0.0.1:8000/"
}
```

It does not meet my expectations. The value of host should be `xxx.com` instead of `127.0.0.1:8000, xxx.com`

Pull request description:
Fix -H option to overwrite default value
Fix #308 

Patch:
diff --git a/src/main.rs b/src/main.rs
index 8f379e7..92f0ae7 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -256,19 +256,6 @@ async fn main() -> anyhow::Result<()> {
             http::header::HeaderValue::from_str(url.authority())?,
         );
 
-        headers.extend(
-            opts.headers
-                .into_iter()
-                .map(|s| {
-                    let header = s.splitn(2, ':').collect::<Vec<_>>();
-                    anyhow::ensure!(header.len() == 2, anyhow::anyhow!("Parse header"));
-                    let name = HeaderName::from_str(header[0])?;
-                    let value = HeaderValue::from_str(header[1].trim_start_matches(' '))?;
-                    Ok::<(HeaderName, HeaderValue), anyhow::Error>((name, value))
-                })
-                .collect::<anyhow::Result<Vec<_>>>()?,
-        );
-
         // User agent
         headers
             .entry(http::header::USER_AGENT)
@@ -325,6 +312,21 @@ async fn main() -> anyhow::Result<()> {
             headers.insert(http::header::CONNECTION, HeaderValue::from_static("close"));
         }
 
+        for (k, v) in opts
+            .headers
+            .into_iter()
+            .map(|s| {
+                let header = s.splitn(2, ':').collect::<Vec<_>>();
+                anyhow::ensure!(header.len() == 2, anyhow::anyhow!("Parse header"));
+                let name = HeaderName::from_str(header[0])?;
+                let value = HeaderValue::from_str(header[1].trim_start_matches(' '))?;
+                Ok::<(HeaderName, HeaderValue), anyhow::Error>((name, value))
+            })
+            .collect::<anyhow::Result<Vec<_>>>()?
+        {
+            headers.insert(k, v);
+        }
+
         headers
     };
 


Test patch:
diff --git a/tests/tests.rs b/tests/tests.rs
index 3b92851..4317ea3 100644
--- a/tests/tests.rs
+++ b/tests/tests.rs
@@ -421,6 +421,8 @@ async fn test_setting_custom_header() {
 async fn test_setting_accept_header() {
     let header = get_header_body(&["-A", "text/html"]).await.0;
     assert_eq!(header.get("accept").unwrap().to_str().unwrap(), "text/html");
+    let header = get_header_body(&["-H", "accept:text/html"]).await.0;
+    assert_eq!(header.get("accept").unwrap().to_str().unwrap(), "text/html");
 }
 
 #[tokio::test]
@@ -439,6 +441,11 @@ async fn test_setting_content_type_header() {
         header.get("content-type").unwrap().to_str().unwrap(),
         "text/html"
     );
+    let header = get_header_body(&["-H", "content-type:text/html"]).await.0;
+    assert_eq!(
+        header.get("content-type").unwrap().to_str().unwrap(),
+        "text/html"
+    );
 }
 
 #[tokio::test]
@@ -454,6 +461,9 @@ async fn test_setting_basic_auth() {
 async fn test_setting_host() {
     let header = get_header_body(&["--host", "hatoo.io"]).await.0;
     assert_eq!(header.get("host").unwrap().to_str().unwrap(), "hatoo.io");
+
+    let header = get_header_body(&["-H", "host:hatoo.io"]).await.0;
+    assert_eq!(header.get("host").unwrap().to_str().unwrap(), "hatoo.io");
 }
 
 #[tokio::test]