-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send HTTP 404 when a sheet doesn't exist #198
Comments
dufferzafar
changed the title
Detect if a cheatsheet exists or not using HTTP HEAD?
Send HTTP 404 when a sheet doesn't exist
May 20, 2020
Yes, it is a bug, I confirm it |
4 tasks
Also for this situation:
But this is also a different issue |
12 tasks
bors bot
added a commit
to orhun/halp
that referenced
this issue
Mar 17, 2023
10: fix(cheat): don't use a pager when no cheat sheet found for the command r=orhun a=figsoda <!--- Thank you for contributing to halp! 🐙 --> ## Description cheat.sh doesn't return 404: chubin/cheat.sh#198 ## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> ## How Has This Been Tested? ```console $ cargo run plz 42 Compiling halp v0.1.3 (/home/figsoda/halp) Finished dev [unoptimized + debuginfo] target(s) in 0.37s Running `target/debug/halp plz 42` ❤ Select operation · Show cheat sheet Unknown topic. Do you mean one of these topics maybe? * m4 50 * p4 50 * r2 50 (ノ´ヮ`)ノ*: ・゚ Select operation › Show man page ✧ Show cheat sheet Exit ``` <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Screenshots / Logs (if applicable) ## Types of Changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation (no code change) - [ ] Refactor (refactoring production code) - [ ] Other <!--- (provide information) --> ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] My code follows the code style of this project. - [ ] I have updated the documentation accordingly. - [x] I have formatted the code with [rustfmt](https://github.com/rust-lang/rustfmt). - [x] I checked the lints with [clippy](https://github.com/rust-lang/rust-clippy). - [ ] I have added tests to cover my changes. - [x] All new and existing tests passed. Co-authored-by: figsoda <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wanted to check if a few cheat sheets exist on cht.sh or not. The right way to do this would be via HTTP status codes, so I fired up a few HEAD requests. But cht.sh always returns 200 - even when sheets don't exist.
From the headers, it's hard to see if the cheatsheet exists on the repo or not.
Content-Length
could be an indicator.But I think the right thing would be to return 404 along with the message?
The text was updated successfully, but these errors were encountered: