Giter Club home page Giter Club logo

httpref's Introduction

HTTP Reference

This is a handy little helper that puts HTTP reference at your fingertips, when you're on the CLI, when you need it.

ko-fi

codecov godoc report card

GitHub watchers GitHub stars

Twitter URL

But why?

Because I can never remember what the bloody http status codes mean, or the details of methods, or whatever. It's annoying!

Why not just wikipedia?

Well it boils down to 2 things:

  1. If I use the browser then it means that I have to use the mouse, or a track pad or something.
  2. I'm a little bored on a Friday night. There's some rubbish film on. Quite frankly I'm a little bored.
  3. If I make it good enough then people will give me stars. This, as everyone knows, is a proxy for love and it will make up for many deficiencies in my life.
  4. My attention to detail is incredible. I therefore invite you to sponsor me using the links at the top of the page. :)

Before we get any further, I'm really interested in how you feel about this tool. Please take the time to fill in this short survey: https://forms.gle/mHh6idwwUvdfYZM67

Installation

$ go install github.com/dnnrly/httpref/cmd/httpref@latest

Usage

Filter by Title

$ httpref 1
  1xx  Informational response
  100  Continue
  101  Switching
  102  Processing
  103  Early hints


$ httpref 200
200 - OK

The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default.

The meaning of a success depends on the HTTP request method:

    GET: The resource has been fetched and is transmitted in the message body.
    HEAD: The entity headers are in the message body.
    POST: The resource describing the result of the action is transmitted in the message body.
    TRACE: The message body contains the request message as received by the server.

The successful result of a PUT or a DELETE is often not a 200 OK but a 204 No Content (or a 201 Created when the resource is uploaded for the first time).

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200


$ httpref <div>
<div>
  The Content Division element

The <div> HTML element is the generic container for flow content. It has no effect on the content or
layout until styled in some way using "CSS" (e.g. styling is directly applied to it, or some kind of
layout model like Flexbox is applied to its parent element).

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div

Full-text Search

The --search option accepts a term to full-text search. This option is available for header, html, method, and status references.

$ httpref --search clear
Clear-Site-Data
  Clears browsing data (e.g. cookies, storage, cache) associated with the requesting
   website.
205
  Reset Content
431
  Request Header Fields Too Large

HTML Elements Reference

The html subcommand looks up 100+ active and deprecated HTML elements.

$ httpref html <abbr>
<abbr>
  The Abbreviation element

The <abbr> HTML element represents an abbreviation or acronym.

When including an abbreviation or acronym, provide a full expansion of the term in plain text on
first use, along with the "<abbr>" to mark up the abbreviation. This informs the user what the
abbreviation or acronym means.

The optional "title" attribute can provide an expansion for the abbreviation or acronym when a full
expansion is not present. This provides a hint to user agents on how to announce/display the content
while informing all users what the abbreviation means. If present, "title" must contain this full
description and nothing else.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/abbr


$ httpref html --search anchor
<a>
  The Anchor element

The <a> HTML element (or _anchor_ element), with its "href" attribute, creates a hyperlink to web
pages, files, email addresses, locations in the same page, or anything else a URL can address.

Content within each "<a>" _should_ indicate the link's destination. If the "href" attribute is
present, pressing the enter key while focused on the "<a>" element will activate it.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

Important make targets

  • deps - downloads all of the deps you need to build, test, and release
  • build - builds your application
  • test - runs unit tests
  • ci-test - run tests for CI validation
  • acceptance-test - run the acceptance tests
  • lint - run linting
  • update - update Go dependencies
  • clean - clean project dependencies
  • clean-deps - remove all of the build dependencies too

httpref's People

Contributors

aporcupine avatar dnnrly avatar georgettica avatar jan-carreras avatar jesselang avatar othorotka avatar selborsolrac avatar sharadnair7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

httpref's Issues

Add free text search

Is your feature request related to a problem? Please describe.

There's a lot of information in this reference tool. It would be nice if we had the ability to search for terms that weren't only in titles.

Describe the solution you'd like

Perhaps something like this:

$ httpref --search auth

Authorisation
    This is a header that...

402
    This is returned when the request is unauthorised...

The search would be case insensitive (option?) and search though both headers and bodies.

Do we want to allow searches restricted to headers or status codes?

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

InRange returns incorrect registered ports

Describe the bug

Some range registered ports are returned incorrectly

To Reproduce

make build
./httpref ports 16404
16384-16403
[... redacted ...]

Expected behavior

The range returned should include the port requested. Like so:

./httpref ports 16404
16403-16472
[... redacted ...]

Desktop

System Version: macOS 10.15.5 (19F101) Kernel Version: Darwin 19.5.0

Additional context

The httpref.InRange function should change a condition from if code >= parts[0] || code <= parts[len(parts)-1] to if code >= parts[0] && code <= parts[len(parts)-1] to correctly identify the range.

I would like to submit a PR fixing this issue and improving the test case to ensure that the expected range is returned. Is that okay with you?

Add borders and colors

Is your feature request related to a problem? Please describe.
Add borders/coloring to improve readability.

Describe the solution you'd like
Add borders around sections and add colors highlighting specific parts. The application already did a good job differentiating the important sections(title, summary and description) in a struct, leveraging these highlighting can be added without changing much of the code.

Additional context
The project already uses Lip Gloss package. The mentioned improvements can be achieved by using the same package without adding any additional dependencies.

Root level filtering is broken

Describe the bug
Using a filter at the root of the command should work for EVERYTHING

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Better reference formatting

Is your feature request related to a problem? Please describe.

Formatting of the output in this tool is rather cumbersome. It would be great if we could use a modern CLI formatting library to do something better, perhaps using something like this:
https://github.com/charmbracelet/lipgloss

Describe the solution you'd like
Better control over the look and feel of the output. Perhaps some additional configuration to customise it for user needs.

Colourised output

Is your feature request related to a problem? Please describe.

Perhaps we could use a package like https://github.com/muesli/termenv to add colours to our output.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

References for HTML

Is your feature request related to a problem? Please describe.
There are a lot of things that developers need to refer to when developing software. This tool is a good reference to some of the lower level information we use but is there anything else that could be useful?

Describe the solution you'd like
It would be good if, similar to headers, we had a reference of common HTML elements.

Missing Authorize header

Describe the bug
Missing header!

To Reproduce
Steps to reproduce the behavior:
httpref Authorize

Expected behavior
Should display the details of the header

Add HTTP 599 response

Is your feature request related to a problem? Please describe.
I've seen 599 errors returned from Apache and it feels like it should be covered here.

Describe the solution you'd like
Concise description of 599 and a link to any further reading.

Additional formatting

Is your feature request related to a problem? Please describe.

A lot of very good work has been done to add much better formatting.

Describe the solution you'd like

  • Increase line coverage in tests
  • Remove panic from root package
  • Maybe a Brucy-bonus use of visitor pattern for applying formatting

Filtering with extended names cannot match shorter string

Describe the bug
If there are 2 (or more) entries where the name of 1 is an extnension of the other then it is not possible to print the exact match

To Reproduce
Steps to reproduce the behavior:

$ httpref headers Accept-CH
        Accept-CH       Servers can advertise support for Client Hints using the Accept-CH header field or an equivalent HTML <meta> element with http-equiv attribute ([HTML5]).
        Accept-CH-Lifetime      Servers can ask the client to remember the set of Client Hints that the server supports for a specified period of time, to enable delivery of Client Hints on subsequent requests to the server’s origin ([RFC6454]).

Expected behavior
There should be a way of finding the exact match

Migrate to godog acceptance tests

Is your feature request related to a problem? Please describe.

At the moment, we have to include non-go dependencies to run acceptance tests. This is bash based and tricky to get right. We could achieve just as much with godog, without having to switch to another language. And go has more testing features/libraries available.

Describe the solution you'd like
BATS acceptance tests replaced with Godog ones.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.