-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f0e524
commit 9f82df9
Showing
16 changed files
with
102 additions
and
119 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
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
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 was deleted.
Oops, something went wrong.
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,32 @@ | ||
# Data Filtering & Querying | ||
|
||
When browsing an HTTP response in Slumber, you may want to filter, query, or otherwise transform the response to make it easier to view. Slumber supports this via embedded shell commands. The query box at the bottom of the response pane allows you to execute any shell command, which will be passed the response body via stdin and its output will be shown in the response pane. You can use `grep`, `jq`, `sed`, or any other text processing tool. | ||
|
||
![Querying response via jq](../../images/query_jq.gif) | ||
|
||
_Example of querying with jq_ | ||
|
||
![Querying response with pipes](../../images/query_pipe.gif) | ||
|
||
_Example of using pipes in a query command_ | ||
|
||
## Side Effects | ||
|
||
Keep in mind that your queries are being executed as shell commands on your system. You should avoid running any commands that interact with the file system, such as using `>` or `<` to pipe to/from files. TODO add more about side-effect commands once implemented | ||
|
||
## Errors | ||
|
||
We can't all be perfect. Sometimes you run a command that fails. To view the error, press `?` (make sure you exit the text box first!). | ||
|
||
![View query error](../../images/query_error.gif) | ||
|
||
## Which shell does Slumber use? | ||
|
||
By default, Slumber executes your command via `sh -c` on Unix and `cmd /S /C` on Windows. You can customize this via the [`commands.shell` configuration field](../../api/configuration/index.md#commandsshell). For example, to use `fish` instead of `sh`: | ||
|
||
```yaml | ||
commands: | ||
shell: [fish, -c] | ||
``` | ||
If you don't want to execute via _any_ shell, you can set it to `[]`. In this case, query commands will be parsed via [shell-words](https://docs.rs/shell-words/latest/shell_words/) and executed directly. For example, `jq .args` will be parsed into `["jq", ".args"]`, then `jq` will be executed with a single argument: `.args`. |
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,29 @@ | ||
Output "docs/src/images/query_error.gif" | ||
Set Shell bash | ||
Set Width 1200 | ||
Set Height 800 | ||
Set FontSize 18 | ||
Set Framerate 24 | ||
Set Margin 0 | ||
Set Padding 10 | ||
Set Theme "MaterialDark" | ||
|
||
Hide | ||
Type "cargo run" | ||
Enter | ||
Sleep 2s | ||
|
||
Enter # Send login request | ||
Type "hunter2" | ||
Enter | ||
Sleep 2s | ||
Type "rf" # Fullscreen response pane | ||
Show | ||
|
||
Type "/" | ||
Sleep 1s | ||
Type "jq error!" | ||
Enter | ||
Sleep 1s | ||
Type "?" | ||
Sleep 3s |
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,26 @@ | ||
Output "docs/src/images/query_pipe.gif" | ||
Set Shell bash | ||
Set Width 1200 | ||
Set Height 800 | ||
Set FontSize 18 | ||
Set Framerate 24 | ||
Set Margin 0 | ||
Set Padding 10 | ||
Set Theme "MaterialDark" | ||
|
||
Hide | ||
Type "cargo run" | ||
Enter | ||
Sleep 2s | ||
|
||
Enter # Send login request | ||
Type "hunter2" | ||
Enter | ||
Sleep 2s | ||
Type "rf" # Fullscreen response pane | ||
Show | ||
|
||
Type "/" | ||
Sleep 1s | ||
Type "jq .args | head -n 3" | ||
Sleep 2s |