Compare commits

...

6 Commits
3.0.0 ... 3.0.1

Author SHA1 Message Date
3b441fa57e 3.0.1 2022-01-23 13:58:01 +01:00
c815e21ef9 Fix time elapsed (#1277)
* Show the actual time elapsed; add docs

* `requests.Response._headers_parsed_at` → `requests.Response._httpie_headers_parsed_at`

* Add `ELAPSED_TIME_LABEL` constant

* Tweak docs

* Tweak docs

* Allow multiple blank lines in Markdown files

* Add rudimentary tests for --meta with different --style’s

* Cleanup tests

* Cleanup tests

* Cleanup tests
2022-01-23 04:52:38 -08:00
8a03b7a824 Update the contributors (#1275) 2022-01-22 17:25:00 -08:00
b3f29c8d1e Display the latest docs (#1274) 2022-01-21 22:15:55 +03:00
a88e44c284 Fix make brew-test
`brew test` is only usable for non-from-source installations.
2022-01-21 19:48:35 +01:00
c97fe64a37 Update brew with 3.0 (#1273) 2022-01-21 21:08:33 +03:00
16 changed files with 434 additions and 84 deletions

View File

@ -3,6 +3,10 @@
This document records all notable changes to [HTTPie](https://httpie.io). This document records all notable changes to [HTTPie](https://httpie.io).
This project adheres to [Semantic Versioning](https://semver.org/). This project adheres to [Semantic Versioning](https://semver.org/).
## [3.0.1](https://github.com/httpie/httpie/compare/3.0.0...3.0.1) (2022-01-23)
- Changed the value shown as time elapsed from time-to-read-headers to total exchange time ([#1277](https://github.com/httpie/httpie/issues/1277))
## [3.0.0](https://github.com/httpie/httpie/compare/2.6.0...3.0.0) (2022-01-21) ## [3.0.0](https://github.com/httpie/httpie/compare/2.6.0...3.0.0) (2022-01-21)
- Dropped support for Python 3.6. ([#1177](https://github.com/httpie/httpie/issues/1177)) - Dropped support for Python 3.6. ([#1177](https://github.com/httpie/httpie/issues/1177))

View File

@ -206,7 +206,8 @@ brew-test:
- brew install --build-from-source ./docs/packaging/brew/httpie.rb - brew install --build-from-source ./docs/packaging/brew/httpie.rb
@echo $(H1)Verifying…$(H1END) @echo $(H1)Verifying…$(H1END)
brew test httpie http --version
https --version
@echo $(H1)Auditing…$(H1END) @echo $(H1)Auditing…$(H1END)
brew audit --strict httpie brew audit --strict httpie

View File

@ -538,7 +538,7 @@ and URL parameters. This is a very practical way of constructing
HTTP requests from scratch on the CLI. HTTP requests from scratch on the CLI.
Each *request item* is simply a key/value pair separated with the following Each *request item* is simply a key/value pair separated with the following
characters: `:` (headers), `=` (data field, e.g JSON, Form), `:=` (raw data field) characters: `:` (headers), `=` (data field, e.g., JSON, form), `:=` (raw data field)
`==` (query parameters), `@` (file upload). `==` (query parameters), `@` (file upload).
```bash ```bash
@ -550,9 +550,9 @@ $ http PUT pie.dev/put \
``` ```
| Item Type | Description | | Item Type | Description |
| -----------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |-------------------------------------------------------------:|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| HTTP Headers `Name:Value` | Arbitrary HTTP header, e.g. `X-API-Token:123` | | HTTP Headers `Name:Value` | Arbitrary HTTP header, e.g. `X-API-Token:123` |
| URL parameters `name==value` | Appends the given name/value pair as a querystring parameter to the URL. The `==` separator is used. | | URL parameters `name==value` | Appends the given name/value pair as a querystring parameter to the URL. The `==` separator is used. |
| Data Fields `field=value` | Request data fields to be serialized as a JSON object (default), to be form-encoded (with `--form, -f`), or to be serialized as `multipart/form-data` (with `--multipart`) | | Data Fields `field=value` | Request data fields to be serialized as a JSON object (default), to be form-encoded (with `--form, -f`), or to be serialized as `multipart/form-data` (with `--multipart`) |
| Raw JSON fields `field:=json` | Useful when sending JSON and one or more fields need to be a `Boolean`, `Number`, nested `Object`, or an `Array`, e.g., `meals:='["ham","spam"]'` or `pies:=[1,2,3]` (note the quotes) | | Raw JSON fields `field:=json` | Useful when sending JSON and one or more fields need to be a `Boolean`, `Number`, nested `Object`, or an `Array`, e.g., `meals:='["ham","spam"]'` or `pies:=[1,2,3]` (note the quotes) |
| File upload fields `field@/dir/file`, `field@file;type=mime` | Only available with `--form`, `-f` and `--multipart`. For example `screenshot@~/Pictures/img.png`, or `'cv@cv.txt;type=text/markdown'`. With `--form`, the presence of a file field results in a `--multipart` request | | File upload fields `field@/dir/file`, `field@file;type=mime` | Only available with `--form`, `-f` and `--multipart`. For example `screenshot@~/Pictures/img.png`, or `'cv@cv.txt;type=text/markdown'`. With `--form`, the presence of a file field results in a `--multipart` request |
@ -570,7 +570,7 @@ to pass the desired value from a file.
$ http POST pie.dev/post \ $ http POST pie.dev/post \
X-Data:@files/text.txt # Read a header from a file X-Data:@files/text.txt # Read a header from a file
token==@files/text.txt # Read a query parameter from a file token==@files/text.txt # Read a query parameter from a file
name=@files/text.txt # Read a data field's value from a file name=@files/text.txt # Read a data fields value from a file
bookmarks:=@files/data.json # Embed a JSON object from a file bookmarks:=@files/data.json # Embed a JSON object from a file
``` ```
@ -681,11 +681,11 @@ Other JSON types, however, are not allowed with `--form` or `--multipart`.
"search": { "search": {
"id": 1, "id": 1,
"type": "id" "type": "id"
} }
} }
``` ```
Building arrays is also possible, through `[]` suffix (an append operation). This tells HTTPie to create an array in the given path (if there is not one already), and append the given value to that array. Building arrays is also possible, through `[]` suffix (an append operation). This tells HTTPie to create an array in the given path (if there is not one already), and append the given value to that array.
```bash ```bash
$ http --offline --print=B pie.dev/post \ $ http --offline --print=B pie.dev/post \
@ -696,7 +696,7 @@ $ http --offline --print=B pie.dev/post \
``` ```
```json ```json
{ {
"category": "tools", "category": "tools",
"search": { "search": {
"keywords": [ "keywords": [
@ -807,7 +807,7 @@ $ http --offline --print=B pie.dev/post \
```bash ```bash
$ http --offline --print=B pie.dev/post \ $ http --offline --print=B pie.dev/post \
'foo\[bar\]:=1' \ 'foo\[bar\]:=1' \
'baz[\[]:=2' \ 'baz[\[]:=2' \
'baz[\]]:=3' 'baz[\]]:=3'
``` ```
@ -845,7 +845,7 @@ $ http --offline --print=B pie.dev/post \
'object[\1]=stringified' \ 'object[\1]=stringified' \
'object[\100]=same' \ 'object[\100]=same' \
'array[1]=indexified' 'array[1]=indexified'
``` ```
```json ```json
{ {
@ -903,8 +903,8 @@ You can follow to given instruction (adding a `]`) and repair your expression.
``` ```
```json ```json
{ {
"user": { "user": {
"name": "string" "name": "string"
} }
} }
@ -1010,7 +1010,7 @@ world
```bash ```bash
$ http --form --multipart --offline example.org hello=world Content-Type:multipart/letter $ http --form --multipart --offline example.org hello=world Content-Type:multipart/letter
``` ```
```http ```http
POST / HTTP/1.1 POST / HTTP/1.1
@ -1104,7 +1104,7 @@ To send a header with an empty value, use `Header;`, with a semicolon:
```bash ```bash
http --offline example.org Numbers:one,two http --offline example.org Numbers:one,two
``` ```
```http ```http
GET / HTTP/1.1 GET / HTTP/1.1
@ -1174,7 +1174,7 @@ $ nc pie.dev 80 < request.http
Cookie: sessionid=foo Cookie: sessionid=foo
Host: pie.dev Host: pie.dev
User-Agent: HTTPie/0.9.9 User-Agent: HTTPie/0.9.9
``` ```
Send multiple cookies (note: the header is quoted to prevent the shell from interpreting the `;`): Send multiple cookies (note: the header is quoted to prevent the shell from interpreting the `;`):
@ -1438,15 +1438,15 @@ By default, HTTPie only outputs the final response and the whole response
| `b` | response body | | `b` | response body |
| `m` | response meta | | `m` | response meta |
Print request and response headers: Print request and response headers:
```bash ```bash
$ http --print=Hh PUT pie.dev/put hello=world $ http --print=Hh PUT pie.dev/put hello=world
``` ```
#### Response meta #### Response meta
`--verbose` can often be useful for debugging the request and generating documentation examples: The response metadata section currently includes the total time elapsed. Its the number of seconds between opening the network connection and downloading the last byte of response the body.
Please note that it also includes time spent on formatting the output, which adds a small penalty. Also, if the body is not part of the output, we dont spend time downloading it — please see [conditional body download](#conditional-body-download). Please note that it also includes time spent on formatting the output, which adds a small penalty. Also, if the body is not part of the output, we dont spend time downloading it — please see [conditional body download](#conditional-body-download).
@ -1454,7 +1454,7 @@ All the other [output options](#output-options) are under the hood just shortcut
### Verbose output ### Verbose output
Host: pie.dev
`--verbose` can often be useful for debugging the request and generating documentation examples: `--verbose` can often be useful for debugging the request and generating documentation examples:
```bash ```bash
@ -1467,6 +1467,15 @@ Print request and response headers:
User-Agent: HTTPie/0.2.7dev User-Agent: HTTPie/0.2.7dev
{ {
"hello": "world"
}
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 477
Content-Type: application/json
Date: Sun, 05 Aug 2012 00:25:23 GMT
Server: gunicorn/0.13.4
{ {
[] []
@ -1628,7 +1637,7 @@ On macOS, you can send the contents of the clipboard with `pbpaste`:
``` ```
### Request data from a filename ### Request data from a filename
An alternative to redirected `stdin` is specifying a filename (as `@/path/to/file`) whose content is used as if it came from `stdin`. An alternative to redirected `stdin` is specifying a filename (as `@/path/to/file`) whose content is used as if it came from `stdin`.
It has the advantage that the `Content-Type` header is automatically set to the appropriate value based on the filename extension. It has the advantage that the `Content-Type` header is automatically set to the appropriate value based on the filename extension.
@ -1711,21 +1720,21 @@ Syntax highlighting is applied to HTTP headers and bodies (where it makes sense)
HTTPie looks at `Content-Type` to select the right syntax highlighter and formatter for each message body. If that fails (e.g., the server provides the wrong type), or you prefer a different treatment, you can manually overwrite the mime type for a response with `--response-mime`: HTTPie looks at `Content-Type` to select the right syntax highlighter and formatter for each message body. If that fails (e.g., the server provides the wrong type), or you prefer a different treatment, you can manually overwrite the mime type for a response with `--response-mime`:
```bash ```bash
$ http --response-mime=text/yaml pie.dev/get $ http --response-mime=text/yaml pie.dev/get
``` ```
Formatting has the following effects: Formatting has the following effects:
- HTTP headers are sorted by name. - HTTP headers are sorted by name.
- JSON data is indented, sorted by keys, and unicode escapes are converted - JSON data is indented, sorted by keys, and unicode escapes are converted
to the characters they represent. to the characters they represent.
- XML and XHTML data is indented. - XML and XHTML data is indented.
Please note that sometimes there might be changes made by formatters on the actual response body (e.g., Please note that sometimes there might be changes made by formatters on the actual response body (e.g.,
collapsing empty tags on XML) but the end result will always be semantically indistinguishable. Some of collapsing empty tags on XML) but the end result will always be semantically indistinguishable. Some of
these formatting changes can be configured more granularly through [format options](#format-options). these formatting changes can be configured more granularly through [format options](#format-options).
### Format options ### Format options
The `--format-options=opt1:value,opt2:value` option allows you to control how the output should be formatted The `--format-options=opt1:value,opt2:value` option allows you to control how the output should be formatted
when formatting is applied. The following options are available: when formatting is applied. The following options are available:
@ -1744,7 +1753,7 @@ Formatting has the following effects:
```bash ```bash
$ http --format-options headers.sort:false,json.sort_keys:false,json.indent:2 pie.dev/get $ http --format-options headers.sort:false,json.sort_keys:false,json.indent:2 pie.dev/get
``` ```
There are also two shortcuts that allow you to quickly disable and re-enable There are also two shortcuts that allow you to quickly disable and re-enable
sorting-related format options (currently it means JSON keys and headers): sorting-related format options (currently it means JSON keys and headers):
@ -1754,7 +1763,7 @@ The `--format-options=opt1:value,opt2:value` option allows you to control how th
### Redirected output ### Redirected output
HTTPie uses a different set of defaults for redirected output than for [terminal output](#terminal-output). HTTPie uses a different set of defaults for redirected output than for [terminal output](#terminal-output).
The differences being: The differences being:
- Formatting and colors arent applied (unless `--pretty` is specified). - Formatting and colors arent applied (unless `--pretty` is specified).
@ -1903,7 +1912,7 @@ $ http -dco file.zip example.org/file
Streamed output by small chunks à la `tail -f`: Streamed output by small chunks à la `tail -f`:
```bash ```bash
# Send each new line (JSON object) to another URL as soon as it arrives from a streaming API: # Send each new line (JSON object) to another URL as soon as it arrives from a streaming API:
$ http --stream pie.dev/stream/3 | while read line; do echo "$line" | http pie.dev/post ; done $ http --stream pie.dev/stream/3 | while read line; do echo "$line" | http pie.dev/post ; done
``` ```
@ -1982,7 +1991,7 @@ $ http --session=user2 -a user2:password pie.dev/get X-Bar:Foo
$ http --session=~/.config/httpie/sessions/another.example.org/test.json example.org $ http --session=~/.config/httpie/sessions/another.example.org/test.json example.org
``` ```
When creating anonymous sessions, please remember to always include at least one `/`, even if the session files is located in the current directory (i.e. `--session=./session.json` instead of just `--session=session.json`), otherwise HTTPie assumes a named session instead. When creating anonymous sessions, please remember to always include at least one `/`, even if the session files is located in the current directory (i.e. `--session=./session.json` instead of just `--session=session.json`), otherwise HTTPie assumes a named session instead.
### Readonly session ### Readonly session
@ -2078,7 +2087,7 @@ If the server expires an existing cookie, it will also be removed from the sessi
#### `default_options` #### `default_options`
An `Array` (by default empty) of default options that should be applied to every invocation of HTTPie. An `Array` (by default empty) of default options that should be applied to every invocation of HTTPie.
For instance, you can use this config option to change your default color theme: For instance, you can use this config option to change your default color theme:
```bash ```bash
@ -2120,7 +2129,7 @@ $ cat ~/.config/httpie/config.json
case $? in case $? in
2) echo 'Request timed out!' ;; 2) echo 'Request timed out!' ;;
3) echo 'Unexpected HTTP 3xx Redirection!' ;; 3) echo 'Unexpected HTTP 3xx Redirection!' ;;
4) echo 'HTTP 4xx Client Error!' ;; 4) echo 'HTTP 4xx Client Error!' ;;
5) echo 'HTTP 5xx Server Error!' ;; 5) echo 'HTTP 5xx Server Error!' ;;
6) echo 'Exceeded --max-redirects=<n> redirects!' ;; 6) echo 'Exceeded --max-redirects=<n> redirects!' ;;
*) echo 'Other Error!' ;; *) echo 'Other Error!' ;;
@ -2185,11 +2194,11 @@ This command is currently in beta.
List all installed plugins. List all installed plugins.
```bash ```bash
$ httpie plugins list $ httpie plugins list
httpie_plugin (1.0.2) httpie_plugin (1.0.2)
httpie_plugin (httpie.plugins.auth.v1) httpie_plugin (httpie.plugins.auth.v1)
httpie_plugin_2 (1.0.6) httpie_plugin_2 (1.0.6)
httpie_plugin_2 (httpie.plugins.auth.v1) httpie_plugin_2 (httpie.plugins.auth.v1)
httpie_converter (1.0.0) httpie_converter (1.0.0)
httpie_iterm_converter (httpie.plugins.converter.v1) httpie_iterm_converter (httpie.plugins.converter.v1)
httpie_konsole_konverter (httpie.plugins.converter.v1) httpie_konsole_konverter (httpie.plugins.converter.v1)
@ -2232,7 +2241,7 @@ $ httpie plugins upgrade httpie-plugin
``` ```
with the HTTPie command that sends it: with the HTTPie command that sends it:
```bash ```bash
$ http -f POST pie.dev/post \ $ http -f POST pie.dev/post \
X-API-Key:123 \ X-API-Key:123 \

View File

@ -1,5 +1,5 @@
{ {
"website": { "website": {
"master_and_released_docs_differ_after": "d40f06687f8cbbd22bf7dba05bee93aea11a169f" "master_and_released_docs_differ_after": null
} }
} }

View File

@ -1,19 +1,45 @@
{ {
"Aaron Miller": {
"committed": [],
"github": "aaronhmiller",
"reported": [
"3.0.0"
],
"twitter": "aaronmiller8"
},
"Alexander Bogdanov": {
"committed": [],
"github": "ab-kily",
"reported": [
"3.0.0"
],
"twitter": null
},
"Almad": { "Almad": {
"committed": [ "committed": [
"2.5.0" "2.5.0"
], ],
"github": "Almad", "github": "Almad",
"reported": [ "reported": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": "almadcz" "twitter": "almadcz"
}, },
"Andr\u00e1s Czig\u00e1ny": {
"committed": [],
"github": "andrascz",
"reported": [
"3.0.0"
],
"twitter": null
},
"Annette Wilson": { "Annette Wilson": {
"committed": [], "committed": [],
"github": "annettejanewilson", "github": "annettejanewilson",
"reported": [ "reported": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": null "twitter": null
}, },
@ -25,6 +51,32 @@
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"Batuhan Taskaya": {
"committed": [
"3.0.0"
],
"github": "isidentical",
"reported": [
"3.0.0"
],
"twitter": "isidentical"
},
"Brad Crittenden": {
"committed": [],
"github": "bac",
"reported": [
"3.0.0"
],
"twitter": null
},
"Chad": {
"committed": [],
"github": "cythrawll",
"reported": [
"3.0.0"
],
"twitter": null
},
"D8ger": { "D8ger": {
"committed": [], "committed": [],
"github": "caofanCPU", "github": "caofanCPU",
@ -35,7 +87,8 @@
}, },
"Dave": { "Dave": {
"committed": [ "committed": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "davecheney", "github": "davecheney",
"reported": [], "reported": [],
@ -49,6 +102,14 @@
], ],
"twitter": "DawidFerenczy" "twitter": "DawidFerenczy"
}, },
"Ed Rooth": {
"committed": [],
"github": "sym3tri",
"reported": [
"3.0.0"
],
"twitter": null
},
"Elena Lape": { "Elena Lape": {
"committed": [ "committed": [
"2.5.0" "2.5.0"
@ -61,7 +122,8 @@
"committed": [], "committed": [],
"github": "peruzzof", "github": "peruzzof",
"reported": [ "reported": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": null "twitter": null
}, },
@ -73,6 +135,22 @@
], ],
"twitter": null "twitter": null
}, },
"Gabriel Cruz": {
"committed": [],
"github": "gmelodie",
"reported": [
"3.0.0"
],
"twitter": "gmelodiecruz"
},
"Gaurav": {
"committed": [
"3.0.0"
],
"github": "gkcs",
"reported": [],
"twitter": null
},
"Giampaolo Rodola": { "Giampaolo Rodola": {
"committed": [], "committed": [],
"github": "giampaolo", "github": "giampaolo",
@ -81,6 +159,14 @@
], ],
"twitter": null "twitter": null
}, },
"Greg Myers": {
"committed": [
"3.0.0"
],
"github": "myersg86",
"reported": [],
"twitter": null
},
"Hugh Williams": { "Hugh Williams": {
"committed": [], "committed": [],
"github": "hughpv", "github": "hughpv",
@ -102,21 +188,33 @@
"Jakub Roztocil": { "Jakub Roztocil": {
"committed": [ "committed": [
"2.5.0", "2.5.0",
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "jakubroztocil", "github": "jakubroztocil",
"reported": [ "reported": [
"2.5.0", "2.5.0",
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": "jakubroztocil" "twitter": "jakubroztocil"
}, },
"Jan Bra\u0161na": {
"committed": [
"3.0.0"
],
"github": "janbrasna",
"reported": [],
"twitter": "janbrasna"
},
"Jan Verbeek": { "Jan Verbeek": {
"committed": [ "committed": [
"2.5.0" "2.5.0"
], ],
"github": "blyxxyz", "github": "blyxxyz",
"reported": [], "reported": [
"3.0.0"
],
"twitter": null "twitter": null
}, },
"Jannik Vieten": { "Jannik Vieten": {
@ -127,6 +225,22 @@
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"Jesper Holmberg": {
"committed": [],
"github": "strindberg",
"reported": [
"3.0.0"
],
"twitter": null
},
"Kirill Krasnov": {
"committed": [],
"github": "Kirill",
"reported": [
"3.0.0"
],
"twitter": null
},
"Marcel St\u00f6r": { "Marcel St\u00f6r": {
"committed": [ "committed": [
"2.5.0" "2.5.0"
@ -135,6 +249,14 @@
"reported": [], "reported": [],
"twitter": "frightanic" "twitter": "frightanic"
}, },
"Marco Seguri": {
"committed": [],
"github": "seguri",
"reported": [
"3.0.0"
],
"twitter": null
},
"Mariano Ruiz": { "Mariano Ruiz": {
"committed": [], "committed": [],
"github": "mrsarm", "github": "mrsarm",
@ -143,22 +265,41 @@
], ],
"twitter": "mrsarm82" "twitter": "mrsarm82"
}, },
"Mark Rosenbaum": {
"committed": [],
"github": "markrosenbaum",
"reported": [
"3.0.0"
],
"twitter": null
},
"Micka\u00ebl Schoentgen": { "Micka\u00ebl Schoentgen": {
"committed": [ "committed": [
"2.5.0", "2.5.0",
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "BoboTiG", "github": "BoboTiG",
"reported": [ "reported": [
"2.5.0", "2.5.0",
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": "__tiger222__" "twitter": "__tiger222__"
}, },
"Mike DePalatis": {
"committed": [],
"github": "mivade",
"reported": [
"3.0.0"
],
"twitter": null
},
"Miro Hron\u010dok": { "Miro Hron\u010dok": {
"committed": [ "committed": [
"2.5.0", "2.5.0",
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "hroncok", "github": "hroncok",
"reported": [], "reported": [],
@ -172,16 +313,42 @@
], ],
"twitter": null "twitter": null
}, },
"Nanashi.": {
"committed": [],
"github": "sevenc-nanashi",
"reported": [
"3.0.0"
],
"twitter": "sevenc_nanashi"
},
"Omer Akram": { "Omer Akram": {
"committed": [ "committed": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "om26er", "github": "om26er",
"reported": [ "reported": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": "om26er" "twitter": "om26er"
}, },
"Patrick Taylor": {
"committed": [],
"github": "pmeister",
"reported": [
"3.0.0"
],
"twitter": null
},
"Paul Laffitte": {
"committed": [],
"github": "paullaffitte",
"reported": [
"3.0.0"
],
"twitter": "plaffitt"
},
"Pavel Alexeev aka Pahan-Hubbitus": { "Pavel Alexeev aka Pahan-Hubbitus": {
"committed": [], "committed": [],
"github": "Hubbitus", "github": "Hubbitus",
@ -190,6 +357,14 @@
], ],
"twitter": null "twitter": null
}, },
"Russell Shurts": {
"committed": [],
"github": "rshurts",
"reported": [
"3.0.0"
],
"twitter": null
},
"Samuel Marks": { "Samuel Marks": {
"committed": [], "committed": [],
"github": "SamuelMarks", "github": "SamuelMarks",
@ -198,6 +373,14 @@
], ],
"twitter": null "twitter": null
}, },
"Sebastian Czech": {
"committed": [
"3.0.0"
],
"github": "sebastianczech",
"reported": [],
"twitter": "sebaczech"
},
"Sullivan SENECHAL": { "Sullivan SENECHAL": {
"committed": [], "committed": [],
"github": "soullivaneuh", "github": "soullivaneuh",
@ -218,7 +401,32 @@
"committed": [], "committed": [],
"github": "vovtz", "github": "vovtz",
"reported": [ "reported": [
"2.6.0" "2.6.0",
"3.0.0"
],
"twitter": null
},
"Vivaan Verma": {
"committed": [
"3.0.0"
],
"github": "doublevcodes",
"reported": [],
"twitter": "doublevcodes"
},
"Vladimir Berkutov": {
"committed": [
"3.0.0"
],
"github": "dair-targ",
"reported": [],
"twitter": null
},
"Will Rogers": {
"committed": [],
"github": "wjrogers",
"reported": [
"3.0.0"
], ],
"twitter": null "twitter": null
}, },
@ -238,6 +446,14 @@
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"arloan": {
"committed": [],
"github": "arloan",
"reported": [
"3.0.0"
],
"twitter": null
},
"bl-ue": { "bl-ue": {
"committed": [ "committed": [
"2.5.0" "2.5.0"
@ -246,22 +462,48 @@
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"blueray453": {
"committed": [],
"github": "blueray453",
"reported": [
"3.0.0"
],
"twitter": null
},
"claudiatd": { "claudiatd": {
"committed": [ "committed": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "claudiatd", "github": "claudiatd",
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"coldcoff": {
"committed": [],
"github": "coldcoff",
"reported": [
"3.0.0"
],
"twitter": null
},
"dkreeft": { "dkreeft": {
"committed": [ "committed": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "dkreeft", "github": "dkreeft",
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"greg": {
"committed": [
"3.0.0"
],
"github": "gregkh",
"reported": [],
"twitter": null
},
"henryhu712": { "henryhu712": {
"committed": [ "committed": [
"2.5.0" "2.5.0"
@ -270,14 +512,31 @@
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"hosseingt": {
"committed": [
"3.0.0"
],
"github": "hosseingt",
"reported": [],
"twitter": null
},
"jakubroztocil": { "jakubroztocil": {
"committed": [ "committed": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"github": "jkbr", "github": "jkbr",
"reported": [], "reported": [],
"twitter": null "twitter": null
}, },
"josephworks": {
"committed": [],
"github": "josephworks",
"reported": [
"3.0.0"
],
"twitter": null
},
"jungle-boogie": { "jungle-boogie": {
"committed": [], "committed": [],
"github": "jungle-boogie", "github": "jungle-boogie",
@ -286,6 +545,14 @@
], ],
"twitter": null "twitter": null
}, },
"luisuimi": {
"committed": [],
"github": "luisuimi",
"reported": [
"3.0.0"
],
"twitter": null
},
"nixbytes": { "nixbytes": {
"committed": [ "committed": [
"2.5.0" "2.5.0"
@ -294,6 +561,14 @@
"reported": [], "reported": [],
"twitter": "linuxbyte3" "twitter": "linuxbyte3"
}, },
"peterpt": {
"committed": [],
"github": "peterpt",
"reported": [
"3.0.0"
],
"twitter": null
},
"qiulang": { "qiulang": {
"committed": [], "committed": [],
"github": "qiulang", "github": "qiulang",
@ -302,6 +577,30 @@
], ],
"twitter": null "twitter": null
}, },
"stonebig": {
"committed": [],
"github": "stonebig",
"reported": [
"3.0.0"
],
"twitter": null
},
"whodidthis": {
"committed": [],
"github": "whodidthis",
"reported": [
"3.0.0"
],
"twitter": null
},
"zoulja": {
"committed": [],
"github": "zoulja",
"reported": [
"3.0.0"
],
"twitter": null
},
"zwx00": { "zwx00": {
"committed": [], "committed": [],
"github": "zwx00", "github": "zwx00",
@ -314,7 +613,8 @@
"committed": [], "committed": [],
"github": "rogerdehe", "github": "rogerdehe",
"reported": [ "reported": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": null "twitter": null
}, },
@ -322,7 +622,8 @@
"committed": [], "committed": [],
"github": "hh-in-zhuzhou", "github": "hh-in-zhuzhou",
"reported": [ "reported": [
"2.6.0" "2.6.0",
"3.0.0"
], ],
"twitter": null "twitter": null
} }

View File

@ -20,6 +20,9 @@ exclude_rule 'MD014'
# MD028 Blank line inside blockquote # MD028 Blank line inside blockquote
exclude_rule 'MD028' exclude_rule 'MD028'
# MD012 Multiple consecutive blank lines
exclude_rule 'MD012'
# Tell the linter to use ordered lists: # Tell the linter to use ordered lists:
# 1. Foo # 1. Foo
# 2. Bar # 2. Bar

View File

@ -3,8 +3,8 @@ class Httpie < Formula
desc "User-friendly cURL replacement (command-line HTTP client)" desc "User-friendly cURL replacement (command-line HTTP client)"
homepage "https://httpie.io/" homepage "https://httpie.io/"
url "https://files.pythonhosted.org/packages/53/96/cbcfec73c186f076e4443faf3d91cbbc868f18f6323703afd348b1aba46d/httpie-2.6.0.tar.gz" url "https://files.pythonhosted.org/packages/64/ee/7b158899655231322f13ecd313d1a0546efe8b9e75167ec8b7fd9ddf7952/httpie-3.0.0.tar.gz"
sha256 "ef929317b239bbf0a5bb7159b4c5d2edbfc55f8a0bcf9cd24ce597daec2afca5" sha256 "e719711aadf1ecd33278033b96dfef7f4e9e341d3a5d1f166785ac4b7fbdee29"
license "BSD-3-Clause" license "BSD-3-Clause"
head "https://github.com/httpie/httpie.git", branch: "master" head "https://github.com/httpie/httpie.git", branch: "master"

View File

@ -3,6 +3,6 @@ HTTPie: modern, user-friendly command-line HTTP client for the API era.
""" """
__version__ = '3.0.0' __version__ = '3.0.1'
__author__ = 'Jakub Roztocil' __author__ = 'Jakub Roztocil'
__licence__ = 'BSD' __licence__ = 'BSD'

View File

@ -3,6 +3,7 @@ import http.client
import json import json
import sys import sys
from contextlib import contextmanager from contextlib import contextmanager
from time import monotonic
from typing import Any, Dict, Callable, Iterable from typing import Any, Dict, Callable, Iterable
from urllib.parse import urlparse, urlunparse from urllib.parse import urlparse, urlunparse
@ -108,7 +109,7 @@ def collect_messages(
**send_kwargs_merged, **send_kwargs_merged,
**send_kwargs, **send_kwargs,
) )
response._httpie_headers_parsed_at = monotonic()
expired_cookies += get_expired_cookies( expired_cookies += get_expired_cookies(
response.headers.get('Set-Cookie', '') response.headers.get('Set-Cookie', '')
) )

View File

@ -1,3 +1,5 @@
from time import monotonic
import requests import requests
from enum import Enum, auto from enum import Enum, auto
@ -15,6 +17,9 @@ from .compat import cached_property
from .utils import split_cookies, parse_content_type_header from .utils import split_cookies, parse_content_type_header
ELAPSED_TIME_LABEL = 'Elapsed time'
class HTTPMessage: class HTTPMessage:
"""Abstract class for HTTP messages.""" """Abstract class for HTTP messages."""
@ -96,7 +101,13 @@ class HTTPResponse(HTTPMessage):
@property @property
def metadata(self) -> str: def metadata(self) -> str:
data = {} data = {}
data['Elapsed time'] = str(self._orig.elapsed.total_seconds()) + 's' time_to_parse_headers = self._orig.elapsed.total_seconds()
# noinspection PyProtectedMember
time_since_headers_parsed = monotonic() - self._orig._httpie_headers_parsed_at
time_elapsed = time_to_parse_headers + time_since_headers_parsed
# data['Headers time'] = str(round(time_to_parse_headers, 5)) + 's'
# data['Body time'] = str(round(time_since_headers_parsed, 5)) + 's'
data[ELAPSED_TIME_LABEL] = str(round(time_elapsed, 10)) + 's'
return '\n'.join( return '\n'.join(
f'{key}: {value}' f'{key}: {value}'
for key, value in data.items() for key, value in data.items()

View File

@ -383,4 +383,5 @@ def make_styles():
PIE_STYLES = make_styles() PIE_STYLES = make_styles()
PIE_STYLE_NAMES = list(PIE_STYLES.keys())
BUNDLED_STYLES |= PIE_STYLES.keys() BUNDLED_STYLES |= PIE_STYLES.keys()

View File

@ -1,4 +1,6 @@
import pygments import pygments
from httpie.models import ELAPSED_TIME_LABEL
from httpie.output.lexers.common import precise from httpie.output.lexers.common import precise
SPEED_TOKENS = { SPEED_TOKENS = {
@ -34,7 +36,7 @@ class MetadataLexer(pygments.lexer.RegexLexer):
tokens = { tokens = {
'root': [ 'root': [
( (
r'(Elapsed time)( *)(:)( *)(\d+\.\d+)(s)', pygments.lexer.bygroups( fr'({ELAPSED_TIME_LABEL})( *)(:)( *)(\d+\.\d+)(s)', pygments.lexer.bygroups(
pygments.token.Name.Decorator, # Name pygments.token.Name.Decorator, # Name
pygments.token.Text, pygments.token.Text,
pygments.token.Operator, # Colon pygments.token.Operator, # Colon

View File

@ -1,7 +1,12 @@
# Copy the brand palette
from typing import Optional from typing import Optional
STYLE_PIE = 'pie'
STYLE_PIE_DARK = 'pie-dark'
STYLE_PIE_LIGHT = 'pie-light'
COLOR_PALETTE = { COLOR_PALETTE = {
# Copy the brand palette
'transparent': 'transparent', 'transparent': 'transparent',
'current': 'currentColor', 'current': 'currentColor',
'white': '#F5F5F0', 'white': '#F5F5F0',
@ -138,10 +143,11 @@ COLOR_PALETTE['primary'] = {
COLOR_PALETTE['secondary'] = {'700': '#37523C', '600': '#6c6969', '500': '#6c6969'} COLOR_PALETTE['secondary'] = {'700': '#37523C', '600': '#6c6969', '500': '#6c6969'}
SHADE_NAMES = { SHADE_NAMES = {
'500': 'pie-dark', '500': STYLE_PIE_DARK,
'600': 'pie', '600': STYLE_PIE,
'700': 'pie-light' '700': STYLE_PIE_LIGHT
} }
SHADES = [ SHADES = [

View File

@ -1,7 +1,17 @@
from .utils import http import pytest
from httpie.models import ELAPSED_TIME_LABEL
from httpie.output.formatters.colors import PIE_STYLE_NAMES
from .utils import http, MockEnvironment, COLOR
def test_meta_elapsed_time(httpbin, monkeypatch): def test_meta_elapsed_time(httpbin):
r = http('--meta', httpbin + '/get') r = http('--meta', httpbin + '/delay/1')
for line in r.splitlines(): assert f'{ELAPSED_TIME_LABEL}: 1.' in r
assert 'Elapsed time' in r
@pytest.mark.parametrize('style', ['auto', 'fruity', *PIE_STYLE_NAMES])
def test_meta_elapsed_time_colors(httpbin, style):
r = http('--style', style, '--meta', httpbin + '/get', env=MockEnvironment(colors=256))
assert COLOR in r
assert ELAPSED_TIME_LABEL in r

View File

@ -17,7 +17,7 @@ from httpie.cli.argtypes import (
) )
from httpie.cli.definition import parser from httpie.cli.definition import parser
from httpie.encoding import UTF8 from httpie.encoding import UTF8
from httpie.output.formatters.colors import PIE_STYLES, get_lexer from httpie.output.formatters.colors import get_lexer, PIE_STYLE_NAMES
from httpie.status import ExitStatus from httpie.status import ExitStatus
from .fixtures import XML_DATA_RAW, XML_DATA_FORMATTED from .fixtures import XML_DATA_RAW, XML_DATA_FORMATTED
from .utils import COLOR, CRLF, HTTP_OK, MockEnvironment, http, DUMMY_URL from .utils import COLOR, CRLF, HTTP_OK, MockEnvironment, http, DUMMY_URL
@ -227,7 +227,7 @@ def test_ensure_contents_colored(httpbin, endpoint):
assert COLOR in r assert COLOR in r
@pytest.mark.parametrize('style', PIE_STYLES.keys()) @pytest.mark.parametrize('style', PIE_STYLE_NAMES)
def test_ensure_meta_is_colored(httpbin, style): def test_ensure_meta_is_colored(httpbin, style):
env = MockEnvironment(colors=256) env = MockEnvironment(colors=256)
r = http('--meta', '--style', style, 'GET', httpbin + '/get', env=env) r = http('--meta', '--style', style, 'GET', httpbin + '/get', env=env)

View File

@ -2,6 +2,7 @@
Here we test our output parsing and matching implementation, not HTTPie itself. Here we test our output parsing and matching implementation, not HTTPie itself.
""" """
from httpie.models import ELAPSED_TIME_LABEL
from httpie.output.writer import MESSAGE_SEPARATOR from httpie.output.writer import MESSAGE_SEPARATOR
from ...utils import CRLF from ...utils import CRLF
from . import assert_output_does_not_match, assert_output_matches, Expect from . import assert_output_does_not_match, assert_output_matches, Expect
@ -111,7 +112,7 @@ def test_assert_output_matches_response_meta():
assert_output_matches( assert_output_matches(
( (
'Key: Value\n' 'Key: Value\n'
'Elapsed Time: 3.3s' f'{ELAPSED_TIME_LABEL}: 3.3s'
), ),
[Expect.RESPONSE_META] [Expect.RESPONSE_META]
) )
@ -124,7 +125,7 @@ def test_assert_output_matches_whole_response():
f'AAA:BBB{CRLF}' f'AAA:BBB{CRLF}'
f'{CRLF}' f'{CRLF}'
f'CCC{MESSAGE_SEPARATOR}' f'CCC{MESSAGE_SEPARATOR}'
'Elapsed Time: 3.3s' f'{ELAPSED_TIME_LABEL}: 3.3s'
), ),
[Expect.RESPONSE_HEADERS, Expect.BODY, Expect.RESPONSE_META] [Expect.RESPONSE_HEADERS, Expect.BODY, Expect.RESPONSE_META]
) )