diff --git a/src/display/menuopts.rs b/src/display/menuopts.rs index e5c6a9f..3b60906 100644 --- a/src/display/menuopts.rs +++ b/src/display/menuopts.rs @@ -170,10 +170,14 @@ pub const METHOD_MENU_OPTIONS: [&str; 7] = [ "PATCH", "HEAD", ]; -pub const HEADER_MENU_OPTIONS: [&str; 5] = [ +pub const HEADER_MENU_OPTIONS: [&str; 9] = [ "Add Custom Header 󰖟 ", - "Add Content-Type: Application/Json  ", - "Add Accept: Application/Json  ", + "Add Content-Type: application/json  ", + "Add Content-Type: application/xml  ", + "Add Content-Type: application/X-WWW-Form-Urlencoded  ", + "Add Accept: application/json  ", + "Add Accept: text/html  ", + "Add Accept: application/xml  ", "Enable Response Headers 󰰀 ", "Return to request menu  ", ]; diff --git a/src/display/mod.rs b/src/display/mod.rs index e8a07f5..aff07cd 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -142,7 +142,10 @@ impl AppOptions { ) } pub fn should_append(&self) -> bool { - matches!(self, Self::Headers(_) | Self::NewCookie(_)) + matches!( + self, + Self::Headers(_) | Self::NewCookie(_) | Self::ContentHeaders(_) + ) } pub fn replace_value(&mut self, val: String) { match self { diff --git a/src/screens/headers.rs b/src/screens/headers.rs index f1146c3..6917532 100644 --- a/src/screens/headers.rs +++ b/src/screens/headers.rs @@ -11,29 +11,53 @@ pub fn handle_headers_screen(app: &mut App, frame: &mut Frame<'_>) { match app.selected { // add custom headers - Some(0) => app.goto_screen(&Screen::InputMenu(InputOpt::Headers)), - // + // "Add Content-Type: application/json  ", + // "Add Content-Type: application/xml  ", + // "Add Content-Type: application/X-WWW-Form-Urlencoded  ", + // "Add Accept: application/json  ", + // "Add Accept: text/html  ", + // "Add Accept: application/xml  ", + Some(0) => app.goto_screen(&Screen::RequestMenu(Some(InputOpt::Headers))), // add content-type application/json Some(1) => { app.add_app_option(AppOptions::ContentHeaders(HeaderKind::ContentType( String::from("application/json"), ))); } - // // add accept application/json Some(2) => { + app.add_app_option(AppOptions::ContentHeaders(HeaderKind::ContentType( + String::from("application/xml"), + ))); + } + Some(3) => { + app.add_app_option(AppOptions::ContentHeaders(HeaderKind::ContentType( + String::from("application/www-form-urlencoded"), + ))); + } + // add accept application/json + Some(4) => { app.add_app_option(AppOptions::ContentHeaders(HeaderKind::Accept( String::from("application/json"), ))); } - // + Some(5) => { + app.add_app_option(AppOptions::ContentHeaders(HeaderKind::ContentType( + String::from("text/html"), + ))); + } + // add accept application/json + Some(6) => { + app.add_app_option(AppOptions::ContentHeaders(HeaderKind::Accept( + String::from("application/xml"), + ))); + } // accept headers in response - Some(3) => { + Some(7) => { app.add_app_option(AppOptions::EnableHeaders); } - // // return to request menu - Some(4) => app.goto_screen(&Screen::RequestMenu(None)), + Some(8) => app.goto_screen(&Screen::RequestMenu(None)), _ => {} } }