Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/earthboundkid/get-headers
Tool that shows headers and stats from GET-ing a URL
https://github.com/earthboundkid/get-headers
curl golang pretty-print request
Last synced: about 2 months ago
JSON representation
Tool that shows headers and stats from GET-ing a URL
- Host: GitHub
- URL: https://github.com/earthboundkid/get-headers
- Owner: earthboundkid
- License: mit
- Created: 2015-11-25T02:39:45.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-19T15:01:14.000Z (8 months ago)
- Last Synced: 2024-10-16T13:39:55.138Z (2 months ago)
- Topics: curl, golang, pretty-print, request
- Language: Go
- Homepage:
- Size: 47.9 KB
- Stars: 28
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# get-headers [![GoDoc](https://godoc.org/github.com/carlmjohnson/get-headers?status.svg)](https://godoc.org/github.com/carlmjohnson/get-headers) [![Go Report Card](https://goreportcard.com/badge/github.com/carlmjohnson/get-headers)](https://goreportcard.com/report/github.com/carlmjohnson/get-headers)
Simple tool to show the headers from GET-ing a URL
The problem this solves is that when you use `curl -I` it does a `HEAD` request, potentially changing the result, and when you do `curl -i` it also dumps the page HTML on you. This does a `GET` and returns those results—including any doubled headers. It also (optionally) downloads the body of the page and returns speed and timing information.
## Installation
First install [Go](http://golang.org).
If you just want to install the binary to your current directory and don't care about the source code, run
```bash
GOBIN=$(pwd) go install github.com/carlmjohnson/get-headers@latest
```## Screenshots
```
$ get-headers https://www.example.com
GET https://www.example.com
HTTP/1.1 200 OKCache-Control max-age=604800
Content-Type text/html
Date Fri, 15 Jan 2016 13:40:38 GMT
Etag "359670651+gzip"
Expires Fri, 22 Jan 2016 13:40:38 GMT
Last-Modified Fri, 09 Aug 2013 23:54:35 GMT
Server ECS (iad/18CB)
Vary Accept-Encoding
X-Cache HIT
X-Ec-Custom-Error 1Time 100ms 204µs
Content length 1.2 KB
Speed 12.4 KB/s
``````
$ get-headers -gzip http://www.example.com
GET http://www.example.com
HTTP/1.1 200 OKCache-Control max-age=604800
Content-Encoding gzip
Content-Length 606
Content-Type text/html
Date Fri, 15 Jan 2016 13:43:28 GMT
Etag "359670651+gzip"
Expires Fri, 22 Jan 2016 13:43:28 GMT
Last-Modified Fri, 09 Aug 2013 23:54:35 GMT
Server ECS (iad/182A)
Vary Accept-Encoding
X-Cache HIT
X-Ec-Custom-Error 1Time 9ms 709µs
Content length 606
Speed 60.9 KB/s
``````
$ get-headers -h
Usage of get-headers v0.21.1:get-headers [opts] ...
Gets the URLs and prints their headers alphabetically.
Repeated headers are printed with an asterisk.Options may be set as GET_HEADERS prefixed environment variables.
-cookie string
Set cookie header
-etag value
Set 'If-None-Match' header to etag value
-g Shortcut for -gzip
-gzip
Enable GZIP compression
-i Shortcut for -ignore-body
-ignore-body
Ignore body of request; close connection after gettings the headers
```