Skip to content

Commit

Permalink
Add sensible defaults to additional HEADER prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Sep 10, 2024
1 parent a7a27ea commit 82de7a5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions h3i/src/prompts/h3/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub fn prompt_push_promise() -> InquireResult<Action> {
fn pseudo_headers(host_port: &str) -> InquireResult<Vec<quiche::h3::Header>> {
let method = Text::new("method:")
.with_autocomplete(&method_suggester)
.with_default("GET")
.with_help_message(ESC_TO_RET)
.prompt()?;

Expand All @@ -126,10 +127,10 @@ fn pseudo_headers(host_port: &str) -> InquireResult<Vec<quiche::h3::Header>> {
.with_help_message(&help)
.prompt()?;

let path = Text::new("path:").prompt()?;
let path = Text::new("path:").with_default("/").prompt()?;

let scheme = Text::new("scheme:")
.with_autocomplete(&scheme_suggester)
.with_default("https")
.with_help_message(ESC_TO_RET)
.prompt()?;

Expand Down Expand Up @@ -170,12 +171,6 @@ fn method_suggester(val: &str) -> SuggestionResult<Vec<String>> {
squish_suggester(&suggestions, val)
}

fn scheme_suggester(val: &str) -> SuggestionResult<Vec<String>> {
let suggestions = ["https"];

squish_suggester(&suggestions, val)
}

fn validate_stream_id(id: &str) -> SuggestionResult<Validation> {
if id.is_empty() {
return Ok(Validation::Valid);
Expand Down

0 comments on commit 82de7a5

Please sign in to comment.