This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from PThorpe92/p_headers
feat: add headers page with 2 default header options. TODO: Add more options
- Loading branch information
Showing
11 changed files
with
156 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ authors = ["PThorpe92 <[email protected]>"] | |
description = "A (ratatui) TUI for HTTP requests with libcurl, recursive downloads with wget, command storage and API key management" | ||
license = "GPL-3.0" | ||
edition = "2021" | ||
repository = "https://github.com/PThorpe92/CuTE" | ||
|
||
[[bin]] | ||
name = "cute" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use tui::prelude::Backend; | ||
use tui::Frame; | ||
|
||
use super::render::handle_screen_defaults; | ||
use super::Screen; | ||
use crate::app::App; | ||
use crate::display::inputopt::InputOpt; | ||
use crate::display::{AppOptions, HeaderKind}; | ||
|
||
pub fn handle_headers_screen<B: Backend>(app: &mut App, frame: &mut Frame<'_, B>) { | ||
handle_screen_defaults(app, frame); | ||
|
||
match app.selected { | ||
// add custom headers | ||
Some(0) => app.goto_screen(Screen::InputMenu(InputOpt::Headers)), | ||
// | ||
// add content-type application/json | ||
Some(1) => { | ||
app.add_app_option(AppOptions::ContentHeaders(HeaderKind::ContentType)); | ||
} | ||
// | ||
// add accept application/json | ||
Some(2) => { | ||
app.add_app_option(AppOptions::ContentHeaders(HeaderKind::Accept)); | ||
} | ||
// | ||
// accept headers in response | ||
Some(3) => { | ||
app.add_app_option(AppOptions::EnableHeaders); | ||
} | ||
// | ||
// return to request menu | ||
Some(4) => app.goto_screen(Screen::RequestMenu(String::new())), | ||
_ => {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters