🎨 style: change `http/https` header word/sentence casing (#555)

Currently all HTTP request headers are in snake case and upper case.
The adopted standard is kebab case and title case.

Here you will find more details:
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Standard_request_fields
This commit is contained in:
Todor Todorov 2024-04-25 20:31:47 +03:00 committed by GitHub
parent 9efcf0b079
commit 93fd8f8565
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 28 additions and 28 deletions

View File

@ -79,13 +79,13 @@ impl SearchEngine for Bing {
}
let header_map = HeaderMap::try_from(&HashMap::from([
("USER_AGENT".to_string(), user_agent.to_string()),
("REFERER".to_string(), "https://google.com/".to_string()),
("User-Agent".to_string(), user_agent.to_string()),
("Referer".to_string(), "https://google.com/".to_string()),
(
"CONTENT_TYPE".to_string(),
"Content-Type".to_string(),
"application/x-www-form-urlencoded".to_string(),
),
("COOKIE".to_string(), cookie_string),
("Cookie".to_string(), cookie_string),
]))
.change_context(EngineError::UnexpectedError)?;

View File

@ -54,14 +54,14 @@ impl SearchEngine for Brave {
};
let header_map = HeaderMap::try_from(&HashMap::from([
("USER_AGENT".to_string(), user_agent.to_string()),
("User-Agent".to_string(), user_agent.to_string()),
(
"CONTENT_TYPE".to_string(),
"Content-Type".to_string(),
"application/x-www-form-urlencoded".to_string(),
),
("REFERER".to_string(), "https://google.com/".to_string()),
("Referer".to_string(), "https://google.com/".to_string()),
(
"COOKIE".to_string(),
"Cookie".to_string(),
format!("safe_search={safe_search_level}"),
),
]))

View File

@ -65,13 +65,13 @@ impl SearchEngine for DuckDuckGo {
// initializing HeaderMap and adding appropriate headers.
let header_map = HeaderMap::try_from(&HashMap::from([
("USER_AGENT".to_string(), user_agent.to_string()),
("REFERER".to_string(), "https://google.com/".to_string()),
("User-Agent".to_string(), user_agent.to_string()),
("Referer".to_string(), "https://google.com/".to_string()),
(
"CONTENT_TYPE".to_string(),
"Content-Type".to_string(),
"application/x-www-form-urlencoded".to_string(),
),
("COOKIE".to_string(), "kl=wt-wt".to_string()),
("Cookie".to_string(), "kl=wt-wt".to_string()),
]))
.change_context(EngineError::UnexpectedError)?;

View File

@ -72,11 +72,11 @@ impl SearchEngine for LibreX {
// initializing HeaderMap and adding appropriate headers.
let header_map = HeaderMap::try_from(&HashMap::from([
("USER_AGENT".to_string(), user_agent.to_string()),
("REFERER".to_string(), "https://google.com/".to_string()),
("CONTENT_TYPE".to_string(), "application/x-www-form-urlencoded".to_string()),
("User-Agent".to_string(), user_agent.to_string()),
("Referer".to_string(), "https://google.com/".to_string()),
("Content-Type".to_string(), "application/x-www-form-urlencoded".to_string()),
(
"COOKIE".to_string(),
"Cookie".to_string(),
"theme=amoled; disable_special=on; disable_frontends=on; language=en; number_of_results=10; safe_search=on; save=1".to_string(),
),
]))

View File

@ -129,13 +129,13 @@ impl SearchEngine for Mojeek {
}
let header_map = HeaderMap::try_from(&HashMap::from([
("USER_AGENT".to_string(), user_agent.to_string()),
("REFERER".to_string(), "https://google.com/".to_string()),
("User-Agent".to_string(), user_agent.to_string()),
("Referer".to_string(), "https://google.com/".to_string()),
(
"CONTENT_TYPE".to_string(),
"Content-Type".to_string(),
"application/x-www-form-urlencoded".to_string(),
),
("COOKIE".to_string(), cookie_string),
("Cookie".to_string(), cookie_string),
]))
.change_context(EngineError::UnexpectedError)?;

View File

@ -66,10 +66,10 @@ impl SearchEngine for Searx {
// initializing headers and adding appropriate headers.
let header_map = HeaderMap::try_from(&HashMap::from([
("USER_AGENT".to_string(), user_agent.to_string()),
("REFERER".to_string(), "https://google.com/".to_string()),
("CONTENT_TYPE".to_string(), "application/x-www-form-urlencoded".to_string()),
("COOKIE".to_string(), "categories=general; language=auto; locale=en; autocomplete=duckduckgo; image_proxy=1; method=POST; safesearch=2; theme=simple; results_on_new_tab=1; doi_resolver=oadoi.org; simple_style=auto; center_alignment=1; query_in_title=1; infinite_scroll=0; disabled_engines=; enabled_engines=\"archive is__general\\054yep__general\\054curlie__general\\054currency__general\\054ddg definitions__general\\054wikidata__general\\054duckduckgo__general\\054tineye__general\\054lingva__general\\054startpage__general\\054yahoo__general\\054wiby__general\\054marginalia__general\\054alexandria__general\\054wikibooks__general\\054wikiquote__general\\054wikisource__general\\054wikiversity__general\\054wikivoyage__general\\054dictzone__general\\054seznam__general\\054mojeek__general\\054naver__general\\054wikimini__general\\054brave__general\\054petalsearch__general\\054goo__general\"; disabled_plugins=; enabled_plugins=\"searx.plugins.hostname_replace\\054searx.plugins.oa_doi_rewrite\\054searx.plugins.vim_hotkeys\"; tokens=; maintab=on; enginetab=on".to_string())
("User-Agent".to_string(), user_agent.to_string()),
("Referer".to_string(), "https://google.com/".to_string()),
("Content-Type".to_string(), "application/x-www-form-urlencoded".to_string()),
("Cookie".to_string(), "categories=general; language=auto; locale=en; autocomplete=duckduckgo; image_proxy=1; method=POST; safesearch=2; theme=simple; results_on_new_tab=1; doi_resolver=oadoi.org; simple_style=auto; center_alignment=1; query_in_title=1; infinite_scroll=0; disabled_engines=; enabled_engines=\"archive is__general\\054yep__general\\054curlie__general\\054currency__general\\054ddg definitions__general\\054wikidata__general\\054duckduckgo__general\\054tineye__general\\054lingva__general\\054startpage__general\\054yahoo__general\\054wiby__general\\054marginalia__general\\054alexandria__general\\054wikibooks__general\\054wikiquote__general\\054wikisource__general\\054wikiversity__general\\054wikivoyage__general\\054dictzone__general\\054seznam__general\\054mojeek__general\\054naver__general\\054wikimini__general\\054brave__general\\054petalsearch__general\\054goo__general\"; disabled_plugins=; enabled_plugins=\"searx.plugins.hostname_replace\\054searx.plugins.oa_doi_rewrite\\054searx.plugins.vim_hotkeys\"; tokens=; maintab=on; enginetab=on".to_string())
]))
.change_context(EngineError::UnexpectedError)?;

View File

@ -57,13 +57,13 @@ impl SearchEngine for Startpage {
// initializing HeaderMap and adding appropriate headers.
let header_map = HeaderMap::try_from(&HashMap::from([
("USER_AGENT".to_string(), user_agent.to_string()),
("REFERER".to_string(), "https://google.com/".to_string()),
("User-Agent".to_string(), user_agent.to_string()),
("Referer".to_string(), "https://google.com/".to_string()),
(
"CONTENT_TYPE".to_string(),
"Content-Type".to_string(),
"application/x-www-form-urlencoded".to_string(),
),
("COOKIE".to_string(), "preferences=connect_to_serverEEE0N1Ndate_timeEEEworldN1Ndisable_family_filterEEE0N1Ndisable_open_in_new_windowEEE0N1Nenable_post_methodEEE1N1Nenable_proxy_safety_suggestEEE1N1Nenable_stay_controlEEE0N1Ninstant_answersEEE1N1Nlang_homepageEEEs%2Fnight%2FenN1NlanguageEEEenglishN1Nlanguage_uiEEEenglishN1Nnum_of_resultsEEE10N1Nsearch_results_regionEEEallN1NsuggestionsEEE1N1Nwt_unitEEEcelsius".to_string()),
("Cookie".to_string(), "preferences=connect_to_serverEEE0N1Ndate_timeEEEworldN1Ndisable_family_filterEEE0N1Ndisable_open_in_new_windowEEE0N1Nenable_post_methodEEE1N1Nenable_proxy_safety_suggestEEE1N1Nenable_stay_controlEEE0N1Ninstant_answersEEE1N1Nlang_homepageEEEs%2Fnight%2FenN1NlanguageEEEenglishN1Nlanguage_uiEEEenglishN1Nnum_of_resultsEEE10N1Nsearch_results_regionEEEallN1NsuggestionsEEE1N1Nwt_unitEEEcelsius".to_string()),
]))
.change_context(EngineError::UnexpectedError)?;