mirror of
https://github.com/httpie/cli.git
synced 2025-08-14 03:38:28 +02:00
Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
5b604c37c6 | |||
2843b874c6 | |||
2105caa49b | |||
8560d1196d | |||
2ef4a57d8c | |||
ff742581f4 | |||
fd30c4ef62 | |||
cee82c825e | |||
9eb8699873 | |||
3037327410 | |||
50e1564600 | |||
f4cf43ecdd | |||
7f03c52d22 | |||
5c068f8102 | |||
10b7d317d0 | |||
3de7c82077 | |||
db16bbee96 | |||
3524ccf0ba | |||
8ac44b57ce | |||
2db28ef692 | |||
7a234d60da | |||
a842a932cc | |||
b934eec7fc | |||
9e8e3691c8 | |||
e52a60e67c | |||
8aa654d1ef | |||
011402152c | |||
30a6f73ec8 | |||
ec4fb84254 | |||
c8c135ffff | |||
2da955fb06 | |||
c2677eeccf | |||
5325a9bc07 | |||
2e3272b5ba | |||
5dc30bc438 | |||
442aa673ac | |||
3e290e5dba | |||
2a9cd226aa | |||
3b58a4a4a2 | |||
7512ca7e47 | |||
cc697db730 | |||
cbe53ed79a | |||
3664644722 |
@ -1,28 +1,22 @@
|
||||
name: Update Autogenerated Files
|
||||
|
||||
name: Update Generated Content
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
regen-autogenerated-files:
|
||||
update-content:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.9
|
||||
|
||||
- run: make regen-all
|
||||
|
||||
- run: make content
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
commit-message: "[automated] Update auto-generated files"
|
||||
title: "[automated] Update auto-generated files"
|
||||
commit-message: "[automated] Update generated content"
|
||||
title: "[automated] Update generated content"
|
||||
delete-branch: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
2
.github/workflows/docs-deploy.yml
vendored
2
.github/workflows/docs-deploy.yml
vendored
@ -17,6 +17,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install HTTPie
|
||||
run: sudo snap install --edge httpie
|
||||
run: sudo pip install httpie
|
||||
- name: Trigger new documentation build
|
||||
run: http --ignore-stdin POST ${{ secrets.DOCS_UPDATE_VERCEL_HOOK }}
|
||||
|
@ -52,7 +52,7 @@ jobs:
|
||||
id: release_id
|
||||
run: |
|
||||
pip install httpie
|
||||
export API_URL="api.github.com/repos/httpie/httpie/releases/tags/${{ github.event.inputs.tag_name }}"
|
||||
export API_URL="api.github.com/repos/httpie/cli/releases/tags/${{ github.event.inputs.tag_name }}"
|
||||
export UPLOAD_URL=`https --ignore-stdin GET $API_URL | jq -r ".upload_url"`
|
||||
echo "::set-output name=UPLOAD_URL::$UPLOAD_URL"
|
||||
|
||||
|
3
.github/workflows/release-snap.yml
vendored
3
.github/workflows/release-snap.yml
vendored
@ -34,7 +34,8 @@ jobs:
|
||||
id: build
|
||||
|
||||
- uses: snapcore/action-publish@v1
|
||||
env:
|
||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_STORE_LOGIN }}
|
||||
with:
|
||||
store_login: ${{ secrets.SNAP_STORE_LOGIN }}
|
||||
snap: ${{ steps.build.outputs.snap }}
|
||||
release: ${{ matrix.level }}
|
||||
|
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
@ -24,12 +24,18 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
python-version: [3.7, 3.8, 3.9, "3.10"]
|
||||
os: [ubuntu-latest, macos-13, windows-latest]
|
||||
python-version:
|
||||
- '3.12'
|
||||
- '3.11'
|
||||
- '3.10'
|
||||
- '3.9'
|
||||
- '3.8'
|
||||
- '3.7'
|
||||
pyopenssl: [0, 1]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
## Patches, features, ideas
|
||||
|
||||
[Complete list of contributors on GitHub](https://github.com/httpie/httpie/graphs/contributors)
|
||||
[Complete list of contributors on GitHub](https://github.com/httpie/cli/graphs/contributors)
|
||||
|
||||
- [Cláudia T. Delgado](https://github.com/claudiatd)
|
||||
- [Hank Gay](https://github.com/gthank)
|
||||
|
259
CHANGELOG.md
259
CHANGELOG.md
@ -3,147 +3,156 @@
|
||||
This document records all notable changes to [HTTPie](https://httpie.io).
|
||||
This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [3.2.2](https://github.com/httpie/httpie/compare/3.2.1...3.2.2) (2022-05-19)
|
||||
## [3.2.4](https://github.com/httpie/cli/compare/3.2.3...3.2.4) (2024-11-01)
|
||||
|
||||
- Fixed compatibility with urllib3 2.0.0. ([#1499](https://github.com/httpie/httpie/issue/1499))
|
||||
- Fix default certs loading and unpin `requests`. ([#1596](https://github.com/httpie/cli/issues/1596))
|
||||
|
||||
## [3.2.1](https://github.com/httpie/httpie/compare/3.1.0...3.2.1) (2022-05-06)
|
||||
## [3.2.3](https://github.com/httpie/cli/compare/3.2.2...3.2.3) (2024-07-10)
|
||||
|
||||
- Improved support for determining auto-streaming when the `Content-Type` header includes encoding information. ([#1383](https://github.com/httpie/httpie/pull/1383))
|
||||
- Fixed the display of the crash happening in the secondary process for update checks. ([#1388](https://github.com/httpie/httpie/issues/1388))
|
||||
- Fix SSL connections by pinning the `requests` version to `2.31.0`. (#1583, #1581)
|
||||
- Make it possible to [unset](https://httpie.io/docs/cli/default-request-headers) the `User-Agent` and `Accept-Encoding` request headers. ([#1502](https://github.com/httpie/cli/issues/1502))
|
||||
|
||||
## [3.2.0](https://github.com/httpie/httpie/compare/3.1.0...3.2.0) (2022-05-05)
|
||||
## [3.2.2](https://github.com/httpie/cli/compare/3.2.1...3.2.2) (2023-05-19)
|
||||
|
||||
- Added a warning for notifying the user about the new updates. ([#1336](https://github.com/httpie/httpie/pull/1336))
|
||||
- Added support for single binary executables. ([#1330](https://github.com/httpie/httpie/pull/1330))
|
||||
- Added support for man pages (and auto generation of them from the parser declaration). ([#1317](https://github.com/httpie/httpie/pull/1317))
|
||||
- Added `http --manual` for man pages & regular manual with pager. ([#1343](https://github.com/httpie/httpie/pull/1343))
|
||||
- Added support for session persistence of repeated headers with the same name. ([#1335](https://github.com/httpie/httpie/pull/1335))
|
||||
- Added support for sending `Secure` cookies to the `localhost` (and `.local` suffixed domains). ([#1308](https://github.com/httpie/httpie/issues/1308))
|
||||
- Improved UI for the progress bars. ([#1324](https://github.com/httpie/httpie/pull/1324))
|
||||
- Fixed redundant creation of `Content-Length` header on `OPTIONS` requests. ([#1310](https://github.com/httpie/httpie/issues/1310))
|
||||
- Fixed blocking of warning thread on some use cases. ([#1349](https://github.com/httpie/httpie/issues/1349))
|
||||
- Changed `httpie plugins` to the new `httpie cli` namespace as `httpie cli plugins` (`httpie plugins` continues to work as a hidden alias). ([#1320](https://github.com/httpie/httpie/issues/1320))
|
||||
- Soft deprecated the `--history-print`. ([#1380](https://github.com/httpie/httpie/pull/1380))
|
||||
- Fixed compatibility with urllib3 2.0.0. ([#1499](https://github.com/httpie/cli/issues/1499))
|
||||
|
||||
## [3.1.0](https://github.com/httpie/httpie/compare/3.0.2...3.1.0) (2022-03-08)
|
||||
## [3.2.1](https://github.com/httpie/cli/compare/3.1.0...3.2.1) (2022-05-06)
|
||||
|
||||
- **SECURITY** Fixed the [vulnerability](https://github.com/httpie/httpie/security/advisories/GHSA-9w4w-cpc8-h2fq) that caused exposure of cookies on redirects to third party hosts. ([#1312](https://github.com/httpie/httpie/pull/1312))
|
||||
- Fixed escaping of integer indexes with multiple backslashes in the nested JSON builder. ([#1285](https://github.com/httpie/httpie/issues/1285))
|
||||
- Fixed displaying of status code without a status message on non-`auto` themes. ([#1300](https://github.com/httpie/httpie/issues/1300))
|
||||
- Fixed redundant issuance of stdin detection warnings on some rare cases due to underlying implementation. ([#1303](https://github.com/httpie/httpie/pull/1303))
|
||||
- Fixed double `--quiet` so that it will now suppress all python level warnings. ([#1271](https://github.com/httpie/httpie/issues/1271))
|
||||
- Added support for specifying certificate private key passphrases through `--cert-key-pass` and prompts. ([#946](https://github.com/httpie/httpie/issues/946))
|
||||
- Added `httpie cli export-args` command for exposing the parser specification for the `http`/`https` commands. ([#1293](https://github.com/httpie/httpie/pull/1293))
|
||||
- Improved regulation of top-level arrays. ([#1292](https://github.com/httpie/httpie/commit/225dccb2186f14f871695b6c4e0bfbcdb2e3aa28))
|
||||
- Improved UI layout for standalone invocations. ([#1296](https://github.com/httpie/httpie/pull/1296))
|
||||
- Improved support for determining auto-streaming when the `Content-Type` header includes encoding information. ([#1383](https://github.com/httpie/cli/pull/1383))
|
||||
- Fixed the display of the crash happening in the secondary process for update checks. ([#1388](https://github.com/httpie/cli/issues/1388))
|
||||
|
||||
## [3.0.2](https://github.com/httpie/httpie/compare/3.0.1...3.0.2) (2022-01-24)
|
||||
## [3.2.0](https://github.com/httpie/cli/compare/3.1.0...3.2.0) (2022-05-05)
|
||||
|
||||
- Added a warning for notifying the user about the new updates. ([#1336](https://github.com/httpie/cli/pull/1336))
|
||||
- Added support for single binary executables. ([#1330](https://github.com/httpie/cli/pull/1330))
|
||||
- Added support for man pages (and auto generation of them from the parser declaration). ([#1317](https://github.com/httpie/cli/pull/1317))
|
||||
- Added `http --manual` for man pages & regular manual with pager. ([#1343](https://github.com/httpie/cli/pull/1343))
|
||||
- Added support for session persistence of repeated headers with the same name. ([#1335](https://github.com/httpie/cli/pull/1335))
|
||||
- Added support for sending `Secure` cookies to the `localhost` (and `.local` suffixed domains). ([#1308](https://github.com/httpie/cli/issues/1308))
|
||||
- Improved UI for the progress bars. ([#1324](https://github.com/httpie/cli/pull/1324))
|
||||
- Fixed redundant creation of `Content-Length` header on `OPTIONS` requests. ([#1310](https://github.com/httpie/cli/issues/1310))
|
||||
- Fixed blocking of warning thread on some use cases. ([#1349](https://github.com/httpie/cli/issues/1349))
|
||||
- Changed `httpie plugins` to the new `httpie cli` namespace as `httpie cli plugins` (`httpie plugins` continues to work as a hidden alias). ([#1320](https://github.com/httpie/cli/issues/1320))
|
||||
- Soft deprecated the `--history-print`. ([#1380](https://github.com/httpie/cli/pull/1380))
|
||||
|
||||
## [3.1.0](https://github.com/httpie/cli/compare/3.0.2...3.1.0) (2022-03-08)
|
||||
|
||||
- **SECURITY** Fixed the [vulnerability](https://github.com/httpie/cli/security/advisories/GHSA-9w4w-cpc8-h2fq) that caused exposure of cookies on redirects to third party hosts. ([#1312](https://github.com/httpie/cli/pull/1312))
|
||||
- Fixed escaping of integer indexes with multiple backslashes in the nested JSON builder. ([#1285](https://github.com/httpie/cli/issues/1285))
|
||||
- Fixed displaying of status code without a status message on non-`auto` themes. ([#1300](https://github.com/httpie/cli/issues/1300))
|
||||
- Fixed redundant issuance of stdin detection warnings on some rare cases due to underlying implementation. ([#1303](https://github.com/httpie/cli/pull/1303))
|
||||
- Fixed double `--quiet` so that it will now suppress all python level warnings. ([#1271](https://github.com/httpie/cli/issues/1271))
|
||||
- Added support for specifying certificate private key passphrases through `--cert-key-pass` and prompts. ([#946](https://github.com/httpie/cli/issues/946))
|
||||
- Added `httpie cli export-args` command for exposing the parser specification for the `http`/`https` commands. ([#1293](https://github.com/httpie/cli/pull/1293))
|
||||
- Improved regulation of top-level arrays. ([#1292](https://github.com/httpie/cli/commit/225dccb2186f14f871695b6c4e0bfbcdb2e3aa28))
|
||||
- Improved UI layout for standalone invocations. ([#1296](https://github.com/httpie/cli/pull/1296))
|
||||
|
||||
## [3.0.2](https://github.com/httpie/cli/compare/3.0.1...3.0.2) (2022-01-24)
|
||||
|
||||
[What’s new in HTTPie for Terminal 3.0 →](https://httpie.io/blog/httpie-3.0.0)
|
||||
|
||||
- Fixed usage of `httpie` when there is a presence of a config with `default_options`. ([#1280](https://github.com/httpie/httpie/pull/1280))
|
||||
- Fixed usage of `httpie` when there is a presence of a config with `default_options`. ([#1280](https://github.com/httpie/cli/pull/1280))
|
||||
|
||||
## [3.0.1](https://github.com/httpie/httpie/compare/3.0.0...3.0.1) (2022-01-23)
|
||||
## [3.0.1](https://github.com/httpie/cli/compare/3.0.0...3.0.1) (2022-01-23)
|
||||
|
||||
[What’s new in HTTPie for Terminal 3.0 →](https://httpie.io/blog/httpie-3.0.0)
|
||||
|
||||
- Changed the value shown as time elapsed from time-to-read-headers to total exchange time. ([#1277](https://github.com/httpie/httpie/issues/1277))
|
||||
- Changed the value shown as time elapsed from time-to-read-headers to total exchange time. ([#1277](https://github.com/httpie/cli/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/cli/compare/2.6.0...3.0.0) (2022-01-21)
|
||||
|
||||
[What’s new in HTTPie for Terminal 3.0 →](https://httpie.io/blog/httpie-3.0.0)
|
||||
|
||||
- Dropped support for Python 3.6. ([#1177](https://github.com/httpie/httpie/issues/1177))
|
||||
- Improved startup time by 40%. ([#1211](https://github.com/httpie/httpie/pull/1211))
|
||||
- Added support for nested JSON syntax. ([#1169](https://github.com/httpie/httpie/issues/1169))
|
||||
- Added `httpie plugins` interface for plugin management. ([#566](https://github.com/httpie/httpie/issues/566))
|
||||
- Added support for Bearer authentication via `--auth-type=bearer` ([#1215](https://github.com/httpie/httpie/issues/1215)).
|
||||
- Added support for quick conversions of pasted URLs into HTTPie calls by adding a space after the protocol name (`$ https ://pie.dev` → `https://pie.dev`). ([#1195](https://github.com/httpie/httpie/issues/1195))
|
||||
- Added support for _sending_ multiple HTTP header lines with the same name. ([#130](https://github.com/httpie/httpie/issues/130))
|
||||
- Added support for _receiving_ multiple HTTP headers lines with the same name. ([#1207](https://github.com/httpie/httpie/issues/1207))
|
||||
- Added support for basic JSON types on `--form`/`--multipart` when using JSON only operators (`:=`/`:=@`). ([#1212](https://github.com/httpie/httpie/issues/1212))
|
||||
- Added support for automatically enabling `--stream` when `Content-Type` is `text/event-stream`. ([#376](https://github.com/httpie/httpie/issues/376))
|
||||
- Added support for displaying the total elapsed time through `--meta`/`-vv` or `--print=m`. ([#243](https://github.com/httpie/httpie/issues/243))
|
||||
- Added new `pie-dark`/`pie-light` (and `pie`) styles that match with [HTTPie for Web and Desktop](https://httpie.io/product). ([#1237](https://github.com/httpie/httpie/issues/1237))
|
||||
- Added support for better error handling on DNS failures. ([#1248](https://github.com/httpie/httpie/issues/1248))
|
||||
- Added support for storing prompted passwords in the local sessions. ([#1098](https://github.com/httpie/httpie/issues/1098))
|
||||
- Added warnings about the `--ignore-stdin`, when there is no incoming data from stdin. ([#1255](https://github.com/httpie/httpie/issues/1255))
|
||||
- Fixed crashing due to broken plugins. ([#1204](https://github.com/httpie/httpie/issues/1204))
|
||||
- Fixed auto addition of XML declaration to every formatted XML response. ([#1156](https://github.com/httpie/httpie/issues/1156))
|
||||
- Fixed highlighting when `Content-Type` specifies `charset`. ([#1242](https://github.com/httpie/httpie/issues/1242))
|
||||
- Fixed an unexpected crash when `--raw` is used with `--chunked`. ([#1253](https://github.com/httpie/httpie/issues/1253))
|
||||
- Changed the default Windows theme from `fruity` to `auto`. ([#1266](https://github.com/httpie/httpie/issues/1266))
|
||||
- Dropped support for Python 3.6. ([#1177](https://github.com/httpie/cli/issues/1177))
|
||||
- Improved startup time by 40%. ([#1211](https://github.com/httpie/cli/pull/1211))
|
||||
- Added support for nested JSON syntax. ([#1169](https://github.com/httpie/cli/issues/1169))
|
||||
- Added `httpie plugins` interface for plugin management. ([#566](https://github.com/httpie/cli/issues/566))
|
||||
- Added support for Bearer authentication via `--auth-type=bearer` ([#1215](https://github.com/httpie/cli/issues/1215)).
|
||||
- Added support for quick conversions of pasted URLs into HTTPie calls by adding a space after the protocol name (`$ https ://pie.dev` → `https://pie.dev`). ([#1195](https://github.com/httpie/cli/issues/1195))
|
||||
- Added support for _sending_ multiple HTTP header lines with the same name. ([#130](https://github.com/httpie/cli/issues/130))
|
||||
- Added support for _receiving_ multiple HTTP headers lines with the same name. ([#1207](https://github.com/httpie/cli/issues/1207))
|
||||
- Added support for basic JSON types on `--form`/`--multipart` when using JSON only operators (`:=`/`:=@`). ([#1212](https://github.com/httpie/cli/issues/1212))
|
||||
- Added support for automatically enabling `--stream` when `Content-Type` is `text/event-stream`. ([#376](https://github.com/httpie/cli/issues/376))
|
||||
- Added support for displaying the total elapsed time through `--meta`/`-vv` or `--print=m`. ([#243](https://github.com/httpie/cli/issues/243))
|
||||
- Added new `pie-dark`/`pie-light` (and `pie`) styles that match with [HTTPie for Web and Desktop](https://httpie.io/product). ([#1237](https://github.com/httpie/cli/issues/1237))
|
||||
- Added support for better error handling on DNS failures. ([#1248](https://github.com/httpie/cli/issues/1248))
|
||||
- Added support for storing prompted passwords in the local sessions. ([#1098](https://github.com/httpie/cli/issues/1098))
|
||||
- Added warnings about the `--ignore-stdin`, when there is no incoming data from stdin. ([#1255](https://github.com/httpie/cli/issues/1255))
|
||||
- Fixed crashing due to broken plugins. ([#1204](https://github.com/httpie/cli/issues/1204))
|
||||
- Fixed auto addition of XML declaration to every formatted XML response. ([#1156](https://github.com/httpie/cli/issues/1156))
|
||||
- Fixed highlighting when `Content-Type` specifies `charset`. ([#1242](https://github.com/httpie/cli/issues/1242))
|
||||
- Fixed an unexpected crash when `--raw` is used with `--chunked`. ([#1253](https://github.com/httpie/cli/issues/1253))
|
||||
- Changed the default Windows theme from `fruity` to `auto`. ([#1266](https://github.com/httpie/cli/issues/1266))
|
||||
|
||||
## [2.6.0](https://github.com/httpie/httpie/compare/2.5.0...2.6.0) (2021-10-14)
|
||||
## [2.6.0](https://github.com/httpie/cli/compare/2.5.0...2.6.0) (2021-10-14)
|
||||
|
||||
[What’s new in HTTPie for Terminal 2.6.0 →](https://httpie.io/blog/httpie-2.6.0)
|
||||
|
||||
- Added support for formatting & coloring of JSON bodies preceded by non-JSON data (e.g., an XXSI prefix). ([#1130](https://github.com/httpie/httpie/issues/1130))
|
||||
- Added charset auto-detection when `Content-Type` doesn’t include it. ([#1110](https://github.com/httpie/httpie/issues/1110), [#1168](https://github.com/httpie/httpie/issues/1168))
|
||||
- Added `--response-charset` to allow overriding the response encoding for terminal display purposes. ([#1168](https://github.com/httpie/httpie/issues/1168))
|
||||
- Added `--response-mime` to allow overriding the response mime type for coloring and formatting for the terminal. ([#1168](https://github.com/httpie/httpie/issues/1168))
|
||||
- Added the ability to silence warnings through using `-q` or `--quiet` twice (e.g. `-qq`) ([#1175](https://github.com/httpie/httpie/issues/1175))
|
||||
- Added installed plugin list to `--debug` output. ([#1165](https://github.com/httpie/httpie/issues/1165))
|
||||
- Fixed duplicate keys preservation in JSON data. ([#1163](https://github.com/httpie/httpie/issues/1163))
|
||||
- Added support for formatting & coloring of JSON bodies preceded by non-JSON data (e.g., an XXSI prefix). ([#1130](https://github.com/httpie/cli/issues/1130))
|
||||
- Added charset auto-detection when `Content-Type` doesn’t include it. ([#1110](https://github.com/httpie/cli/issues/1110), [#1168](https://github.com/httpie/cli/issues/1168))
|
||||
- Added `--response-charset` to allow overriding the response encoding for terminal display purposes. ([#1168](https://github.com/httpie/cli/issues/1168))
|
||||
- Added `--response-mime` to allow overriding the response mime type for coloring and formatting for the terminal. ([#1168](https://github.com/httpie/cli/issues/1168))
|
||||
- Added the ability to silence warnings through using `-q` or `--quiet` twice (e.g. `-qq`) ([#1175](https://github.com/httpie/cli/issues/1175))
|
||||
- Added installed plugin list to `--debug` output. ([#1165](https://github.com/httpie/cli/issues/1165))
|
||||
- Fixed duplicate keys preservation in JSON data. ([#1163](https://github.com/httpie/cli/issues/1163))
|
||||
|
||||
## [2.5.0](https://github.com/httpie/httpie/compare/2.4.0...2.5.0) (2021-09-06)
|
||||
## [2.5.0](https://github.com/httpie/cli/compare/2.4.0...2.5.0) (2021-09-06)
|
||||
|
||||
[What’s new in HTTPie for Terminal 2.5.0 →](https://httpie.io/blog/httpie-2.5.0)
|
||||
|
||||
- Added `--raw` to allow specifying the raw request body without extra processing as
|
||||
an alternative to `stdin`. ([#534](https://github.com/httpie/httpie/issues/534))
|
||||
- Added support for XML formatting. ([#1129](https://github.com/httpie/httpie/issues/1129))
|
||||
- Added internal support for file-like object responses to improve adapter plugin support. ([#1094](https://github.com/httpie/httpie/issues/1094))
|
||||
- Fixed `--continue --download` with a single byte to be downloaded left. ([#1032](https://github.com/httpie/httpie/issues/1032))
|
||||
- Fixed `--verbose` HTTP 307 redirects with streamed request body. ([#1088](https://github.com/httpie/httpie/issues/1088))
|
||||
- Fixed handling of session files with `Cookie:` followed by other headers. ([#1126](https://github.com/httpie/httpie/issues/1126))
|
||||
an alternative to `stdin`. ([#534](https://github.com/httpie/cli/issues/534))
|
||||
- Added support for XML formatting. ([#1129](https://github.com/httpie/cli/issues/1129))
|
||||
- Added internal support for file-like object responses to improve adapter plugin support. ([#1094](https://github.com/httpie/cli/issues/1094))
|
||||
- Fixed `--continue --download` with a single byte to be downloaded left. ([#1032](https://github.com/httpie/cli/issues/1032))
|
||||
- Fixed `--verbose` HTTP 307 redirects with streamed request body. ([#1088](https://github.com/httpie/cli/issues/1088))
|
||||
- Fixed handling of session files with `Cookie:` followed by other headers. ([#1126](https://github.com/httpie/cli/issues/1126))
|
||||
|
||||
## [2.4.0](https://github.com/httpie/httpie/compare/2.3.0...2.4.0) (2021-02-06)
|
||||
## [2.4.0](https://github.com/httpie/cli/compare/2.3.0...2.4.0) (2021-02-06)
|
||||
|
||||
- Added support for `--session` cookie expiration based on `Set-Cookie: max-age=<n>`. ([#1029](https://github.com/httpie/httpie/issues/1029))
|
||||
- Show a `--check-status` warning with `--quiet` as well, not only when the output is redirected. ([#1026](https://github.com/httpie/httpie/issues/1026))
|
||||
- Fixed upload with `--session` ([#1020](https://github.com/httpie/httpie/issues/1020)).
|
||||
- Fixed a missing blank line between request and response ([#1006](https://github.com/httpie/httpie/issues/1006)).
|
||||
- Added support for `--session` cookie expiration based on `Set-Cookie: max-age=<n>`. ([#1029](https://github.com/httpie/cli/issues/1029))
|
||||
- Show a `--check-status` warning with `--quiet` as well, not only when the output is redirected. ([#1026](https://github.com/httpie/cli/issues/1026))
|
||||
- Fixed upload with `--session` ([#1020](https://github.com/httpie/cli/issues/1020)).
|
||||
- Fixed a missing blank line between request and response ([#1006](https://github.com/httpie/cli/issues/1006)).
|
||||
|
||||
## [2.3.0](https://github.com/httpie/httpie/compare/2.2.0...2.3.0) (2020-10-25)
|
||||
## [2.3.0](https://github.com/httpie/cli/compare/2.2.0...2.3.0) (2020-10-25)
|
||||
|
||||
- Added support for streamed uploads ([#201](https://github.com/httpie/httpie/issues/201)).
|
||||
- Added support for multipart upload streaming ([#684](https://github.com/httpie/httpie/issues/684)).
|
||||
- Added support for streamed uploads ([#201](https://github.com/httpie/cli/issues/201)).
|
||||
- Added support for multipart upload streaming ([#684](https://github.com/httpie/cli/issues/684)).
|
||||
- Added support for body-from-file upload streaming (`http pie.dev/post @file`).
|
||||
- Added `--chunked` to enable chunked transfer encoding ([#753](https://github.com/httpie/httpie/issues/753)).
|
||||
- Added `--chunked` to enable chunked transfer encoding ([#753](https://github.com/httpie/cli/issues/753)).
|
||||
- Added `--multipart` to allow `multipart/form-data` encoding for non-file `--form` requests as well.
|
||||
- Added support for preserving field order in multipart requests ([#903](https://github.com/httpie/httpie/issues/903)).
|
||||
- Added support for preserving field order in multipart requests ([#903](https://github.com/httpie/cli/issues/903)).
|
||||
- Added `--boundary` to allow a custom boundary string for `multipart/form-data` requests.
|
||||
- Added support for combining cookies specified on the CLI and in a session file ([#932](https://github.com/httpie/httpie/issues/932)).
|
||||
- Added out of the box SOCKS support with no extra installation ([#904](https://github.com/httpie/httpie/issues/904)).
|
||||
- Added support for combining cookies specified on the CLI and in a session file ([#932](https://github.com/httpie/cli/issues/932)).
|
||||
- Added out of the box SOCKS support with no extra installation ([#904](https://github.com/httpie/cli/issues/904)).
|
||||
- Added `--quiet, -q` flag to enforce silent behaviour.
|
||||
- Fixed the handling of invalid `expires` dates in `Set-Cookie` headers ([#963](https://github.com/httpie/httpie/issues/963)).
|
||||
- Removed Tox testing entirely ([#943](https://github.com/httpie/httpie/issues/943)).
|
||||
- Fixed the handling of invalid `expires` dates in `Set-Cookie` headers ([#963](https://github.com/httpie/cli/issues/963)).
|
||||
- Removed Tox testing entirely ([#943](https://github.com/httpie/cli/issues/943)).
|
||||
|
||||
## [2.2.0](https://github.com/httpie/httpie/compare/2.1.0...2.2.0) (2020-06-18)
|
||||
## [2.2.0](https://github.com/httpie/cli/compare/2.1.0...2.2.0) (2020-06-18)
|
||||
|
||||
- Added support for custom content types for uploaded files ([#668](https://github.com/httpie/httpie/issues/668)).
|
||||
- Added support for `$XDG_CONFIG_HOME` ([#920](https://github.com/httpie/httpie/issues/920)).
|
||||
- Added support for `Set-Cookie`-triggered cookie expiration ([#853](https://github.com/httpie/httpie/issues/853)).
|
||||
- Added `--format-options` to allow disabling sorting, etc. ([#128](https://github.com/httpie/httpie/issues/128))
|
||||
- Added `--sorted` and `--unsorted` shortcuts for (un)setting all sorting-related `--format-options`. ([#128](https://github.com/httpie/httpie/issues/128))
|
||||
- Added `--ciphers` to allow configuring OpenSSL ciphers ([#870](https://github.com/httpie/httpie/issues/870)).
|
||||
- Added support for custom content types for uploaded files ([#668](https://github.com/httpie/cli/issues/668)).
|
||||
- Added support for `$XDG_CONFIG_HOME` ([#920](https://github.com/httpie/cli/issues/920)).
|
||||
- Added support for `Set-Cookie`-triggered cookie expiration ([#853](https://github.com/httpie/cli/issues/853)).
|
||||
- Added `--format-options` to allow disabling sorting, etc. ([#128](https://github.com/httpie/cli/issues/128))
|
||||
- Added `--sorted` and `--unsorted` shortcuts for (un)setting all sorting-related `--format-options`. ([#128](https://github.com/httpie/cli/issues/128))
|
||||
- Added `--ciphers` to allow configuring OpenSSL ciphers ([#870](https://github.com/httpie/cli/issues/870)).
|
||||
- Added `netrc` support for auth plugins. Enabled for `--auth-type=basic`
|
||||
and `digest`, 3rd parties may opt in ([#718](https://github.com/httpie/httpie/issues/718), [#719](https://github.com/httpie/httpie/issues/719), [#852](https://github.com/httpie/httpie/issues/852), [#934](https://github.com/httpie/httpie/issues/934)).
|
||||
- Fixed built-in plugins-related circular imports ([#925](https://github.com/httpie/httpie/issues/925)).
|
||||
and `digest`, 3rd parties may opt in ([#718](https://github.com/httpie/cli/issues/718), [#719](https://github.com/httpie/cli/issues/719), [#852](https://github.com/httpie/cli/issues/852), [#934](https://github.com/httpie/cli/issues/934)).
|
||||
- Fixed built-in plugins-related circular imports ([#925](https://github.com/httpie/cli/issues/925)).
|
||||
|
||||
## [2.1.0](https://github.com/httpie/httpie/compare/2.0.0...2.1.0) (2020-04-18)
|
||||
## [2.1.0](https://github.com/httpie/cli/compare/2.0.0...2.1.0) (2020-04-18)
|
||||
|
||||
- Added `--path-as-is` to bypass dot segment (`/../` or `/./`)
|
||||
URL squashing ([#895](https://github.com/httpie/httpie/issues/895)).
|
||||
URL squashing ([#895](https://github.com/httpie/cli/issues/895)).
|
||||
- Changed the default `Accept` header value for JSON requests from
|
||||
`application/json, */*` to `application/json, */*;q=0.5`
|
||||
to clearly indicate preference ([#488](https://github.com/httpie/httpie/issues/488)).
|
||||
to clearly indicate preference ([#488](https://github.com/httpie/cli/issues/488)).
|
||||
- Fixed `--form` file upload mixed with redirected `stdin` error handling
|
||||
([#840](https://github.com/httpie/httpie/issues/840)).
|
||||
([#840](https://github.com/httpie/cli/issues/840)).
|
||||
|
||||
## [2.0.0](https://github.com/httpie/httpie/compare/1.0.3...2.0.0) (2020-01-12)
|
||||
## [2.0.0](https://github.com/httpie/cli/compare/1.0.3...2.0.0) (2020-01-12)
|
||||
|
||||
- Removed Python 2.7 support ([EOL Jan 2020](https://www.python.org/doc/sunset-python-2/).
|
||||
- Added `--offline` to allow building an HTTP request and printing it but not
|
||||
@ -166,7 +175,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Fixed an error when `stdin` was a closed fd.
|
||||
- Improved `--debug` output formatting.
|
||||
|
||||
## [1.0.3](https://github.com/httpie/httpie/compare/1.0.2...1.0.3) (2019-08-26)
|
||||
## [1.0.3](https://github.com/httpie/cli/compare/1.0.2...1.0.3) (2019-08-26)
|
||||
|
||||
- Fixed CVE-2019-10751 — the way the output filename is generated for
|
||||
`--download` requests without `--output` resulting in a redirect has
|
||||
@ -192,15 +201,15 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
|
||||
Reported by Raul Onitza and Giulio Comi.
|
||||
|
||||
## [1.0.2](https://github.com/httpie/httpie/compare/1.0.1...1.0.2) (2018-11-14)
|
||||
## [1.0.2](https://github.com/httpie/cli/compare/1.0.1...1.0.2) (2018-11-14)
|
||||
|
||||
- Fixed tests for installation with pyOpenSSL.
|
||||
|
||||
## [1.0.1](https://github.com/httpie/httpie/compare/1.0.0...1.0.1) (2018-11-14)
|
||||
## [1.0.1](https://github.com/httpie/cli/compare/1.0.0...1.0.1) (2018-11-14)
|
||||
|
||||
- Removed external URL calls from tests.
|
||||
|
||||
## [1.0.0](https://github.com/httpie/httpie/compare/0.9.9...1.0.0) (2018-11-02)
|
||||
## [1.0.0](https://github.com/httpie/cli/compare/0.9.9...1.0.0) (2018-11-02)
|
||||
|
||||
- Added `--style=auto` which follows the terminal ANSI color styles.
|
||||
- Added support for selecting TLS 1.3 via `--ssl=tls1.3`
|
||||
@ -211,11 +220,11 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Fixed default headers being incorrectly case-sensitive.
|
||||
- Removed Python 2.6 support.
|
||||
|
||||
## [0.9.9](https://github.com/httpie/httpie/compare/0.9.8...0.9.9) (2016-12-08)
|
||||
## [0.9.9](https://github.com/httpie/cli/compare/0.9.8...0.9.9) (2016-12-08)
|
||||
|
||||
- Fixed README.
|
||||
|
||||
## [0.9.8](https://github.com/httpie/httpie/compare/0.9.6...0.9.8) (2016-12-08)
|
||||
## [0.9.8](https://github.com/httpie/cli/compare/0.9.6...0.9.8) (2016-12-08)
|
||||
|
||||
- Extended auth plugin API.
|
||||
- Added exit status code `7` for plugin errors.
|
||||
@ -224,7 +233,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Improved `CTRL-C` interrupt handling.
|
||||
- Added the standard exit status code `130` for keyboard interrupts.
|
||||
|
||||
## [0.9.6](https://github.com/httpie/httpie/compare/0.9.4...0.9.6) (2016-08-13)
|
||||
## [0.9.6](https://github.com/httpie/cli/compare/0.9.4...0.9.6) (2016-08-13)
|
||||
|
||||
- Added Python 3 as a dependency for Homebrew installations
|
||||
to ensure some of the newer HTTP features work out of the box
|
||||
@ -243,7 +252,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Changed the pre-processing of request HTTP headers so that any leading
|
||||
and trailing whitespace is removed.
|
||||
|
||||
## [0.9.4](https://github.com/httpie/httpie/compare/0.9.3...0.9.4) (2016-07-01)
|
||||
## [0.9.4](https://github.com/httpie/cli/compare/0.9.3...0.9.4) (2016-07-01)
|
||||
|
||||
- Added `Content-Type` of files uploaded in `multipart/form-data` requests
|
||||
- Added `--ssl=<PROTOCOL>` to specify the desired SSL/TLS protocol version
|
||||
@ -267,7 +276,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Fixed the handling of `Content-Type` with multiple `+subtype` parts
|
||||
- Removed the XML formatter as the implementation suffered from multiple issues
|
||||
|
||||
## [0.9.3](https://github.com/httpie/httpie/compare/0.9.2...0.9.3) (2016-01-01)
|
||||
## [0.9.3](https://github.com/httpie/cli/compare/0.9.2...0.9.3) (2016-01-01)
|
||||
|
||||
- Changed the default color `--style` from `solarized` to `monokai`
|
||||
- Added basic Bash autocomplete support (need to be installed manually)
|
||||
@ -277,19 +286,19 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Fixed colors and formatting on Windows
|
||||
- Fixed `--auth` prompt on Windows
|
||||
|
||||
## [0.9.2](https://github.com/httpie/httpie/compare/0.9.1...0.9.2) (2015-02-24)
|
||||
## [0.9.2](https://github.com/httpie/cli/compare/0.9.1...0.9.2) (2015-02-24)
|
||||
|
||||
- Fixed compatibility with Requests 2.5.1
|
||||
- Changed the default JSON `Content-Type` to `application/json` as UTF-8
|
||||
is the default JSON encoding
|
||||
|
||||
## [0.9.1](https://github.com/httpie/httpie/compare/0.9.0...0.9.1) (2015-02-07)
|
||||
## [0.9.1](https://github.com/httpie/cli/compare/0.9.0...0.9.1) (2015-02-07)
|
||||
|
||||
- Added support for Requests transport adapter plugins
|
||||
(see [httpie-unixsocket](https://github.com/httpie/httpie-unixsocket)
|
||||
and [httpie-http2](https://github.com/httpie/httpie-http2))
|
||||
|
||||
## [0.9.0](https://github.com/httpie/httpie/compare/0.8.0...0.9.0) (2015-01-31)
|
||||
## [0.9.0](https://github.com/httpie/cli/compare/0.8.0...0.9.0) (2015-01-31)
|
||||
|
||||
- Added `--cert` and `--cert-key` parameters to specify a client side
|
||||
certificate and private key for SSL
|
||||
@ -308,7 +317,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Fixed `--output=/dev/null` on Linux
|
||||
- Miscellaneous bugfixes
|
||||
|
||||
## [0.8.0](https://github.com/httpie/httpie/compare/0.7.1...0.8.0) (2014-01-25)
|
||||
## [0.8.0](https://github.com/httpie/cli/compare/0.7.1...0.8.0) (2014-01-25)
|
||||
|
||||
- Added `field=@file.txt` and `field:=@file.json` for embedding
|
||||
the contents of text and JSON files into request data
|
||||
@ -316,7 +325,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Fixed request `Host` header value output so that it doesn't contain
|
||||
credentials, if included in the URL
|
||||
|
||||
## [0.7.1](https://github.com/httpie/httpie/compare/0.6.0...0.7.1) (2013-09-24)
|
||||
## [0.7.1](https://github.com/httpie/cli/compare/0.6.0...0.7.1) (2013-09-24)
|
||||
|
||||
- Added `--ignore-stdin`
|
||||
- Added support for auth plugins
|
||||
@ -324,27 +333,27 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Improved `Content-Disposition` parsing for `--download` mode
|
||||
- Update to Requests 2.0.0
|
||||
|
||||
## [0.6.0](https://github.com/httpie/httpie/compare/0.5.1...0.6.0) (2013-06-03)
|
||||
## [0.6.0](https://github.com/httpie/cli/compare/0.5.1...0.6.0) (2013-06-03)
|
||||
|
||||
- XML data is now formatted
|
||||
- `--session` and `--session-read-only` now also accept paths to
|
||||
session files (eg. `http --session=/tmp/session.json example.org`)
|
||||
|
||||
## [0.5.1](https://github.com/httpie/httpie/compare/0.5.0...0.5.1) (2013-05-13)
|
||||
## [0.5.1](https://github.com/httpie/cli/compare/0.5.0...0.5.1) (2013-05-13)
|
||||
|
||||
- `Content-*` and `If-*` request headers are not stored in sessions
|
||||
anymore as they are request-specific
|
||||
|
||||
## [0.5.0](https://github.com/httpie/httpie/compare/0.4.1...0.5.0) (2013-04-27)
|
||||
## [0.5.0](https://github.com/httpie/cli/compare/0.4.1...0.5.0) (2013-04-27)
|
||||
|
||||
- Added a download mode via `--download`
|
||||
- Fixes miscellaneous bugs
|
||||
|
||||
## [0.4.1](https://github.com/httpie/httpie/compare/0.4.0...0.4.1) (2013-02-26)
|
||||
## [0.4.1](https://github.com/httpie/cli/compare/0.4.0...0.4.1) (2013-02-26)
|
||||
|
||||
- Fixed `setup.py`
|
||||
|
||||
## [0.4.0](https://github.com/httpie/httpie/compare/0.3.0...0.4.0) (2013-02-22)
|
||||
## [0.4.0](https://github.com/httpie/cli/compare/0.3.0...0.4.0) (2013-02-22)
|
||||
|
||||
- Added Python 3.3 compatibility
|
||||
- Added Requests >= v1.0.4 compatibility
|
||||
@ -353,7 +362,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Mutually exclusive arguments can be specified multiple times. The
|
||||
last value is used
|
||||
|
||||
## [0.3.0](https://github.com/httpie/httpie/compare/0.2.7...0.3.0) (2012-09-21)
|
||||
## [0.3.0](https://github.com/httpie/cli/compare/0.2.7...0.3.0) (2012-09-21)
|
||||
|
||||
- Allow output redirection on Windows
|
||||
- Added configuration file
|
||||
@ -368,7 +377,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
(`--pretty=all`, `--pretty=colors` and `--pretty=format`)
|
||||
`--ugly` has bee removed in favor of `--pretty=none`
|
||||
|
||||
## [0.2.7](https://github.com/httpie/httpie/compare/0.2.5...0.2.7) (2012-08-07)
|
||||
## [0.2.7](https://github.com/httpie/cli/compare/0.2.5...0.2.7) (2012-08-07)
|
||||
|
||||
- Added compatibility with Requests 0.13.6
|
||||
- Added streamed terminal output. `--stream, -S` can be used to enable
|
||||
@ -385,7 +394,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Fixed printing of `multipart/form-data` requests
|
||||
- Renamed `--traceback` to `--debug`
|
||||
|
||||
## [0.2.6](https://github.com/httpie/httpie/compare/0.2.5...0.2.6) (2012-07-26)
|
||||
## [0.2.6](https://github.com/httpie/cli/compare/0.2.5...0.2.6) (2012-07-26)
|
||||
|
||||
- The short option for `--headers` is now `-h` (`-t` has been
|
||||
removed, for usage use `--help`)
|
||||
@ -400,7 +409,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Added query string parameters (`param==value`)
|
||||
- Added support for terminal colors under Windows
|
||||
|
||||
## [0.2.5](https://github.com/httpie/httpie/compare/0.2.2...0.2.5) (2012-07-17)
|
||||
## [0.2.5](https://github.com/httpie/cli/compare/0.2.2...0.2.5) (2012-07-17)
|
||||
|
||||
- Unicode characters in prettified JSON now don't get escaped for
|
||||
improved readability
|
||||
@ -411,20 +420,20 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
`--verbose`
|
||||
- Fixed Content-Type for requests with no data
|
||||
|
||||
## [0.2.2](https://github.com/httpie/httpie/compare/0.2.1...0.2.2) (2012-06-24)
|
||||
## [0.2.2](https://github.com/httpie/cli/compare/0.2.1...0.2.2) (2012-06-24)
|
||||
|
||||
- The `METHOD` positional argument can now be omitted (defaults to
|
||||
`GET`, or to `POST` with data)
|
||||
- Fixed --verbose --form
|
||||
- Added support for Tox
|
||||
|
||||
## [0.2.1](https://github.com/httpie/httpie/compare/0.2.0...0.2.1) (2012-06-13)
|
||||
## [0.2.1](https://github.com/httpie/cli/compare/0.2.0...0.2.1) (2012-06-13)
|
||||
|
||||
- Added compatibility with `requests-0.12.1`
|
||||
- Dropped custom JSON and HTTP lexers in favor of the ones newly included
|
||||
in `pygments-1.5`
|
||||
|
||||
## [0.2.0](https://github.com/httpie/httpie/compare/0.1.6...0.2.0) (2012-04-25)
|
||||
## [0.2.0](https://github.com/httpie/cli/compare/0.1.6...0.2.0) (2012-04-25)
|
||||
|
||||
- Added Python 3 support
|
||||
- Added the ability to print the HTTP request as well as the response
|
||||
@ -436,18 +445,18 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
||||
- Added support for field name escaping
|
||||
- Many bug fixes
|
||||
|
||||
## [0.1.6](https://github.com/httpie/httpie/compare/0.1.5...0.1.6) (2012-03-04)
|
||||
## [0.1.6](https://github.com/httpie/cli/compare/0.1.5...0.1.6) (2012-03-04)
|
||||
|
||||
- Fixed `setup.py`
|
||||
|
||||
## [0.1.5](https://github.com/httpie/httpie/compare/0.1.4...0.1.5) (2012-03-04)
|
||||
## [0.1.5](https://github.com/httpie/cli/compare/0.1.4...0.1.5) (2012-03-04)
|
||||
|
||||
- Many improvements and bug fixes
|
||||
|
||||
## [0.1.4](https://github.com/httpie/httpie/compare/b966efa...0.1.4) (2012-02-28)
|
||||
## [0.1.4](https://github.com/httpie/cli/compare/b966efa...0.1.4) (2012-02-28)
|
||||
|
||||
- Many improvements and bug fixes
|
||||
|
||||
## [0.1.0](https://github.com/httpie/httpie/commit/b966efa) (2012-02-25)
|
||||
## [0.1.0](https://github.com/httpie/cli/commit/b966efa) (2012-02-25)
|
||||
|
||||
- Initial public release
|
||||
|
@ -19,7 +19,7 @@ $ http --debug <COMPLETE ARGUMENT LIST THAT TRIGGERS THE ERROR>
|
||||
|
||||
## 2. Contributing Code and Docs
|
||||
|
||||
Before working on a new feature or a bug, please browse [existing issues](https://github.com/httpie/httpie/issues)
|
||||
Before working on a new feature or a bug, please browse [existing issues](https://github.com/httpie/cli/issues)
|
||||
to see whether it has previously been discussed.
|
||||
|
||||
If your change alters HTTPie’s behaviour or interface, it's a good idea to
|
||||
@ -38,13 +38,13 @@ for existing-yet-previously-untested behavior will very likely be merged.
|
||||
Therefore, docs and tests improvements are a great candidate for your first
|
||||
contribution.
|
||||
|
||||
Consider also adding a [CHANGELOG](https://github.com/httpie/httpie/blob/master/CHANGELOG.md) entry for your changes.
|
||||
Consider also adding a [CHANGELOG](https://github.com/httpie/cli/blob/master/CHANGELOG.md) entry for your changes.
|
||||
|
||||
### Development Environment
|
||||
|
||||
#### Getting the code
|
||||
|
||||
Go to <https://github.com/httpie/httpie> and fork the project repository.
|
||||
Go to <https://github.com/httpie/cli> and fork the project repository.
|
||||
|
||||
```bash
|
||||
# Clone your fork
|
||||
@ -59,7 +59,7 @@ $ git checkout -b my_topical_branch
|
||||
|
||||
#### Setup
|
||||
|
||||
The [Makefile](https://github.com/httpie/httpie/blob/master/Makefile) contains a bunch of tasks to get you started.
|
||||
The [Makefile](https://github.com/httpie/cli/blob/master/Makefile) contains a bunch of tasks to get you started.
|
||||
You can run `$ make` to see all the available tasks.
|
||||
|
||||
To get started, run the command below, which:
|
||||
@ -112,7 +112,7 @@ and that `make pycodestyle` passes.
|
||||
|
||||
Please add tests for any new features and bug fixes.
|
||||
|
||||
When you open a Pull Request, [GitHub Actions](https://github.com/httpie/httpie/actions) will automatically run HTTPie’s [test suite](https://github.com/httpie/httpie/tree/master/tests) against your code, so please make sure all checks pass.
|
||||
When you open a Pull Request, [GitHub Actions](https://github.com/httpie/cli/actions) will automatically run HTTPie’s [test suite](https://github.com/httpie/cli/tree/master/tests) against your code, so please make sure all checks pass.
|
||||
|
||||
#### Running tests locally
|
||||
|
||||
@ -144,7 +144,7 @@ $ python -m pytest tests/test_uploads.py::TestMultipartFormDataFileUpload
|
||||
$ python -m pytest tests/test_uploads.py::TestMultipartFormDataFileUpload::test_upload_ok
|
||||
```
|
||||
|
||||
See [Makefile](https://github.com/httpie/httpie/blob/master/Makefile) for additional development utilities.
|
||||
See [Makefile](https://github.com/httpie/cli/blob/master/Makefile) for additional development utilities.
|
||||
|
||||
#### Running benchmarks
|
||||
|
||||
@ -209,4 +209,4 @@ $ python -m pytest
|
||||
|
||||
______________________________________________________________________
|
||||
|
||||
Finally, feel free to add yourself to [AUTHORS](https://github.com/httpie/httpie/blob/master/AUTHORS.md)!
|
||||
Finally, feel free to add yourself to [AUTHORS](https://github.com/httpie/cli/blob/master/AUTHORS.md)!
|
||||
|
@ -4,5 +4,5 @@ include CHANGELOG.md
|
||||
include AUTHORS.md
|
||||
include docs/README.md
|
||||
|
||||
# <https://github.com/httpie/httpie/issues/182>
|
||||
# <https://github.com/httpie/cli/issues/182>
|
||||
recursive-include tests/ *
|
||||
|
15
Makefile
15
Makefile
@ -124,7 +124,8 @@ test-dist: test-sdist test-bdist-wheel
|
||||
|
||||
test-sdist: clean venv
|
||||
@echo $(H1)Testing sdist build an installation$(H1END)
|
||||
$(VENV_PYTHON) setup.py sdist
|
||||
$(VENV_PIP) install build
|
||||
$(VENV_PYTHON) -m build --sdist
|
||||
$(VENV_PIP) install --force-reinstall --upgrade dist/*.gz
|
||||
$(VENV_BIN)/http --version
|
||||
@echo
|
||||
@ -132,8 +133,8 @@ test-sdist: clean venv
|
||||
|
||||
test-bdist-wheel: clean venv
|
||||
@echo $(H1)Testing wheel build an installation$(H1END)
|
||||
$(VENV_PIP) install wheel
|
||||
$(VENV_PYTHON) setup.py bdist_wheel
|
||||
$(VENV_PIP) install build
|
||||
$(VENV_PYTHON) -m build --wheel
|
||||
$(VENV_PIP) install --force-reinstall --upgrade dist/*.whl
|
||||
$(VENV_BIN)/http --version
|
||||
@echo
|
||||
@ -231,15 +232,15 @@ brew-test:
|
||||
brew audit --strict httpie
|
||||
|
||||
###############################################################################
|
||||
# Regeneration
|
||||
# Generated content
|
||||
###############################################################################
|
||||
|
||||
regen-all: regen-man-pages regen-install-methods
|
||||
content: man installation-docs
|
||||
|
||||
regen-man-pages: install
|
||||
man: install
|
||||
@echo $(H1)Regenerate man pages$(H1END)
|
||||
$(VENV_PYTHON) extras/scripts/generate_man_pages.py
|
||||
|
||||
regen-install-methods:
|
||||
installation-docs:
|
||||
@echo $(H1)Updating installation instructions in the docs$(H1END)
|
||||
$(VENV_PYTHON) docs/installation/generate.py
|
||||
|
29
README.md
29
README.md
@ -1,16 +1,16 @@
|
||||
<h2 align="center">
|
||||
<a href="https://httpie.io" target="blank_">
|
||||
<img height="100" alt="HTTPie" src="https://raw.githubusercontent.com/httpie/httpie/master/docs/httpie-logo.svg" />
|
||||
<img height="100" alt="HTTPie" src="https://raw.githubusercontent.com/httpie/cli/master/docs/httpie-logo.svg" />
|
||||
</a>
|
||||
<br>
|
||||
HTTPie for Terminal: human-friendly CLI HTTP client for the API era
|
||||
HTTPie CLI: human-friendly HTTP client for the API era
|
||||
</h2>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://httpie.io/product)
|
||||
[](https://httpie.io/app)
|
||||
[](https://httpie.io/cli)
|
||||
[](https://httpie.io/product)
|
||||
[](https://httpie.io/app)
|
||||
[](https://httpie.io/cli)
|
||||
[](https://twitter.com/httpie)
|
||||
[](https://httpie.io/discord)
|
||||
|
||||
@ -21,8 +21,9 @@
|
||||
|
||||
[](https://httpie.org/docs/cli)
|
||||
[](https://pypi.python.org/pypi/httpie)
|
||||
[](https://github.com/httpie/httpie/actions)
|
||||
[](https://codecov.io/gh/httpie/httpie)
|
||||
[](https://github.com/httpie/cli/actions)
|
||||
[](https://codecov.io/gh/httpie/cli)
|
||||
[](https://www.pepy.tech/projects/httpie)
|
||||
|
||||
</div>
|
||||
|
||||
@ -34,7 +35,7 @@ They use simple and natural syntax and provide formatted and colorized output.
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="https://raw.githubusercontent.com/httpie/httpie/master/docs/httpie-animation.gif" alt="HTTPie in action" width="100%"/>
|
||||
<img src="https://raw.githubusercontent.com/httpie/cli/master/docs/httpie-animation.gif" alt="HTTPie in action" width="100%"/>
|
||||
|
||||
|
||||
</div>
|
||||
@ -82,16 +83,16 @@ Custom [HTTP method](https://httpie.io/docs#http-method), [HTTP headers](https:/
|
||||
http PUT pie.dev/put X-API-Token:123 name=John
|
||||
```
|
||||
|
||||
Build and print a request without sending it using [offline mode](https://httpie.io/docs#offline-mode):
|
||||
Build and print a request without sending it using [offline mode](https://httpie.io/docs/cli/offline-mode):
|
||||
|
||||
```bash
|
||||
http --offline pie.dev/post hello=offline
|
||||
```
|
||||
|
||||
Use [GitHub API](https://developer.github.com/v3/issues/comments/#create-a-comment) to post a comment on an [Issue](https://github.com/httpie/httpie/issues/83) with [authentication](https://httpie.io/docs#authentication):
|
||||
Use [GitHub API](https://developer.github.com/v3/issues/comments/#create-a-comment) to post a comment on an [Issue](https://github.com/httpie/cli/issues/83) with [authentication](https://httpie.io/docs#authentication):
|
||||
|
||||
```bash
|
||||
http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comments body='HTTPie is awesome! :heart:'
|
||||
http -a USERNAME POST https://api.github.com/repos/httpie/cli/issues/83/comments body='HTTPie is awesome! :heart:'
|
||||
```
|
||||
|
||||
[See more examples →](https://httpie.io/docs#examples)
|
||||
@ -102,11 +103,11 @@ http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comme
|
||||
- Join our [Discord server](https://httpie.io/discord) is to ask questions, discuss features, and for general API chat.
|
||||
- Tweet at [@httpie](https://twitter.com/httpie) on Twitter.
|
||||
- Use [StackOverflow](https://stackoverflow.com/questions/tagged/httpie) to ask questions and include a `httpie` tag.
|
||||
- Create [GitHub Issues](https://github.com/httpie/httpie/issues) for bug reports and feature requests.
|
||||
- Create [GitHub Issues](https://github.com/httpie/cli/issues) for bug reports and feature requests.
|
||||
- Subscribe to the [HTTPie newsletter](https://httpie.io) for occasional updates.
|
||||
|
||||
## Contributing
|
||||
|
||||
Have a look through existing [Issues](https://github.com/httpie/httpie/issues) and [Pull Requests](https://github.com/httpie/httpie/pulls) that you could help with. If you'd like to request a feature or report a bug, please [create a GitHub Issue](https://github.com/httpie/httpie/issues) using one of the templates provided.
|
||||
Have a look through existing [Issues](https://github.com/httpie/cli/issues) and [Pull Requests](https://github.com/httpie/cli/pulls) that you could help with. If you'd like to request a feature or report a bug, please [create a GitHub Issue](https://github.com/httpie/cli/issues) using one of the templates provided.
|
||||
|
||||
[See contribution guide →](https://github.com/httpie/httpie/blob/master/CONTRIBUTING.md)
|
||||
[See contribution guide →](https://github.com/httpie/cli/blob/master/CONTRIBUTING.md)
|
||||
|
177
docs/README.md
177
docs/README.md
@ -19,7 +19,7 @@ This documentation is best viewed at [httpie.io/docs](https://httpie.org/docs).
|
||||
You can select your corresponding HTTPie version as well as run examples directly from the browser using a [termible.io](https://termible.io?utm_source=httpie-readme) embedded terminal.
|
||||
|
||||
If you are reading this on GitHub, then this text covers the current *development* version.
|
||||
You are invited to submit fixes and improvements to the docs by editing [this file](https://github.com/httpie/httpie/blob/master/docs/README.md).
|
||||
You are invited to submit fixes and improvements to the docs by editing [this file](https://github.com/httpie/cli/blob/master/docs/README.md).
|
||||
|
||||
</div>
|
||||
|
||||
@ -126,6 +126,66 @@ $ choco upgrade httpie
|
||||
|
||||
### Linux
|
||||
|
||||
#### Debian and Ubuntu
|
||||
|
||||
Also works for other Debian-derived distributions like MX Linux, Linux Mint, deepin, Pop!_OS, KDE neon, Zorin OS, elementary OS, Kubuntu, Devuan, Linux Lite, Peppermint OS, Lubuntu, antiX, Xubuntu, etc.
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ curl -SsL https://packages.httpie.io/deb/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/httpie.gpg
|
||||
$ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/httpie.gpg] https://packages.httpie.io/deb ./" | sudo tee /etc/apt/sources.list.d/httpie.list > /dev/null
|
||||
$ sudo apt update
|
||||
$ sudo apt install httpie
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ sudo apt update && sudo apt upgrade httpie
|
||||
```
|
||||
|
||||
#### Fedora
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ dnf install httpie
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ dnf upgrade httpie
|
||||
```
|
||||
|
||||
#### CentOS and RHEL
|
||||
|
||||
Also works for other RHEL-derived distributions like ClearOS, Oracle Linux, etc.
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ yum install epel-release
|
||||
$ yum install httpie
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ yum upgrade httpie
|
||||
```
|
||||
|
||||
#### Single binary executables
|
||||
|
||||
Get the standalone HTTPie Linux executables when you don't want to go through the full installation process.
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ https --download packages.httpie.io/binaries/linux/http-latest -o http
|
||||
$ ln -ls ./http ./https
|
||||
$ chmod +x ./http ./https
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ https --download packages.httpie.io/binaries/linux/http-latest -o http
|
||||
```
|
||||
|
||||
#### Snapcraft (Linux)
|
||||
|
||||
To install [Snapcraft](https://snapcraft.io/), see [its installation](https://snapcraft.io/docs/installing-snapd).
|
||||
@ -156,51 +216,6 @@ $ brew update
|
||||
$ brew upgrade httpie
|
||||
```
|
||||
|
||||
#### Debian and Ubuntu
|
||||
|
||||
Also works for other Debian-derived distributions like MX Linux, Linux Mint, deepin, Pop!_OS, KDE neon, Zorin OS, elementary OS, Kubuntu, Devuan, Linux Lite, Peppermint OS, Lubuntu, antiX, Xubuntu, etc.
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ curl -SsL https://packages.httpie.io/deb/KEY.gpg | apt-key add -
|
||||
$ curl -SsL -o /etc/apt/sources.list.d/httpie.list https://packages.httpie.io/deb/httpie.list
|
||||
$ apt update
|
||||
$ apt install httpie
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ apt update
|
||||
$ apt upgrade httpie
|
||||
```
|
||||
|
||||
#### Fedora
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ dnf install httpie
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ dnf upgrade httpie
|
||||
```
|
||||
|
||||
#### CentOS and RHEL
|
||||
|
||||
Also works for other RHEL-derived distributions like ClearOS, Oracle Linux, etc.
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ yum install epel-release
|
||||
$ yum install httpie
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ yum upgrade httpie
|
||||
```
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
Also works for other Arch-derived distributions like ArcoLinux, EndeavourOS, Artix Linux, etc.
|
||||
@ -215,21 +230,6 @@ $ pacman -Syu httpie
|
||||
$ pacman -Syu
|
||||
```
|
||||
|
||||
#### Single binary executables
|
||||
|
||||
Get the standalone HTTPie Linux executables when you don't want to go through the full installation process
|
||||
|
||||
```bash
|
||||
# Install httpie
|
||||
$ https --download packages.httpie.io/binaries/linux/http-latest -o http
|
||||
$ chmod +x ./http
|
||||
```
|
||||
|
||||
```bash
|
||||
# Upgrade httpie
|
||||
$ https --download packages.httpie.io/binaries/linux/http-latest -o http
|
||||
```
|
||||
|
||||
### FreeBSD
|
||||
|
||||
#### FreshPorts
|
||||
@ -255,7 +255,7 @@ If you want to try out the latest version of HTTPie that hasn't been officially
|
||||
You can use the following command to install the development version of HTTPie on Linux, macOS, Windows, or FreeBSD operating systems. With this command, the code present in the `master` branch is downloaded and installed using `pip`.
|
||||
|
||||
```bash
|
||||
$ python -m pip install --upgrade https://github.com/httpie/httpie/archive/master.tar.gz
|
||||
$ python -m pip install --upgrade https://github.com/httpie/cli/archive/master.tar.gz
|
||||
```
|
||||
|
||||
There are other ways to install the development version of HTTPie on macOS and Linux.
|
||||
@ -274,7 +274,7 @@ $ snap remove httpie
|
||||
$ snap install httpie --edge
|
||||
```
|
||||
|
||||
To verify the installation, you can compare the [version identifier on GitHub](https://github.com/httpie/httpie/blob/master/httpie/__init__.py#L6) with the one available on your machine. You can check the version of HTTPie on your machine by using the command `http --version`.
|
||||
To verify the installation, you can compare the [version identifier on GitHub](https://github.com/httpie/cli/blob/master/httpie/__init__.py#L6) with the one available on your machine. You can check the version of HTTPie on your machine by using the command `http --version`.
|
||||
|
||||
```bash
|
||||
$ http --version
|
||||
@ -325,10 +325,10 @@ Build and print a request without sending it using [offline mode](#offline-mode)
|
||||
$ http --offline pie.dev/post hello=offline
|
||||
```
|
||||
|
||||
Use [GitHub API](https://developer.github.com/v3/issues/comments/#create-a-comment) to post a comment on an [issue](https://github.com/httpie/httpie/issues/83) with [authentication](#authentication):
|
||||
Use [GitHub API](https://developer.github.com/v3/issues/comments/#create-a-comment) to post a comment on an [issue](https://github.com/httpie/cli/issues/83) with [authentication](#authentication):
|
||||
|
||||
```bash
|
||||
$ http -a USERNAME POST https://api.github.com/repos/httpie/httpie/issues/83/comments body='HTTPie is awesome! :heart:'
|
||||
$ http -a USERNAME POST https://api.github.com/repos/httpie/cli/issues/83/comments body='HTTPie is awesome! :heart:'
|
||||
```
|
||||
|
||||
Upload a file using [redirected input](#redirected-input):
|
||||
@ -477,7 +477,7 @@ $ http pie.dev/get text==@files/text.txt
|
||||
### URL shortcuts for `localhost`
|
||||
|
||||
Additionally, curl-like shorthand for localhost is supported.
|
||||
This means that, for example, `:3000` would expand to `http://localhost:3000`
|
||||
This means that, for example, `:3000` would expand to `http://localhost:3000`.
|
||||
If the port is omitted, then port 80 is assumed.
|
||||
|
||||
```bash
|
||||
@ -530,7 +530,7 @@ $ http-unix %2Fvar%2Frun%2Fdocker.sock/info
|
||||
|
||||
### `--path-as-is`
|
||||
|
||||
The standard behavior of HTTP clients is to normalize the path portion of URLs by squashing dot segments as a typically filesystem would:
|
||||
The standard behavior of HTTP clients is to normalize the path portion of URLs by squashing dot segments as a typical filesystem would:
|
||||
|
||||
```bash
|
||||
$ http -v example.org/./../../etc/password
|
||||
@ -574,7 +574,7 @@ $ http PUT pie.dev/put \
|
||||
| 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. |
|
||||
| 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 |
|
||||
|
||||
Note that the structured data fields aren’t the only way to specify request data:
|
||||
@ -583,7 +583,7 @@ Note that the structured data fields aren’t the only way to specify request da
|
||||
### File based separators
|
||||
|
||||
Using file contents as values for specific fields is a very common use case, which can be achieved through adding the `@` suffix to
|
||||
the operators above. For example instead of using a static string as the value for some header, you can use `:@` operator
|
||||
the operators above. For example, instead of using a static string as the value for some header, you can use `:@` operator
|
||||
to pass the desired value from a file.
|
||||
|
||||
```bash
|
||||
@ -749,7 +749,7 @@ $ http --offline --print=B pie.dev/post \
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
{
|
||||
"category": "tools",
|
||||
"search": {
|
||||
"keywords": [
|
||||
@ -915,6 +915,8 @@ http --offline --print=B pie.dev/post \
|
||||
"]": 3
|
||||
},
|
||||
"foo[bar]": 1
|
||||
}
|
||||
```
|
||||
|
||||
If you want to send the literal backslash character (`\`), escape it with another backslash:
|
||||
|
||||
@ -1042,7 +1044,7 @@ $ http POST pie.dev/post < files/data.json
|
||||
```bash
|
||||
$ http -f POST pie.dev/post name='John Smith' cv@~/files/data.xml
|
||||
```
|
||||
|
||||
|
||||
The request above is the same as if the following HTML form were submitted:
|
||||
|
||||
```html
|
||||
@ -1174,11 +1176,11 @@ User-Agent: HTTPie/<version>
|
||||
```bash
|
||||
$ http pie.dev/headers 'Header;'
|
||||
```
|
||||
|
||||
|
||||
Please note that some internal headers, such as `Content-Length`, can’t be unset if
|
||||
they are automatically added by the client itself.
|
||||
|
||||
### Multiple header values with the same name
|
||||
### Multiple header values with the same name
|
||||
|
||||
If the request is sent with multiple headers that are sharing the same name, then
|
||||
the HTTPie will send them individually.
|
||||
@ -1233,7 +1235,7 @@ by individual commands when sending a request instead of being joined together.
|
||||
|
||||
Generating raw requests that can be sent with any other client:
|
||||
|
||||
```bash
|
||||
```bash
|
||||
# 1. save a raw request to a file:
|
||||
$ http --offline POST pie.dev/post hello=world > request.http
|
||||
```
|
||||
@ -1752,7 +1754,7 @@ $ http pie.dev/post <<<'{"name": "John"}'
|
||||
$ pbpaste | http PUT pie.dev/put
|
||||
```
|
||||
|
||||
Passing data through `stdin` **can’t** be combined with data fields specified on the command line:
|
||||
Passing data through `stdin` **can’t** be combined with data fields specified on the command line:
|
||||
|
||||
```bash
|
||||
$ echo -n 'data' | http POST example.org more=data # This is invalid
|
||||
@ -2000,7 +2002,7 @@ HTTPie features a download mode in which it acts similarly to `wget`.
|
||||
### Piping while downloading
|
||||
|
||||
You can also redirect the response body to another program while the response headers and progress are still shown in the terminal:
|
||||
|
||||
|
||||
```bash
|
||||
$ http -d https://github.com/httpie/cli/archive/master.tar.gz | tar zxf -
|
||||
```
|
||||
@ -2029,7 +2031,7 @@ To prevent data loss by overwriting, HTTPie adds a unique numerical suffix to th
|
||||
## Streamed responses
|
||||
|
||||
Responses are downloaded and printed in chunks.
|
||||
This allows for streaming and large file downloads without using too much memory.
|
||||
This allows for streaming and large file downloads without using too much memory.
|
||||
However, when [colors and formatting](#colors-and-formatting) are applied, the whole response is buffered and only then processed at once.
|
||||
|
||||
### Disabling buffering
|
||||
@ -2311,7 +2313,7 @@ These flags are available for both `sessions upgrade` and `sessions upgrade-all`
|
||||
|
||||
### Configurable options
|
||||
|
||||
Currently, HTTPie offers a single configurable option:
|
||||
Currently, HTTPie offers a single configurable option:
|
||||
|
||||
#### `default_options`
|
||||
|
||||
@ -2404,7 +2406,7 @@ To prevent your program from becoming unresponsive when the server fails to resp
|
||||
#### `httpie cli export-args`
|
||||
|
||||
`httpie cli export-args` command can expose the parser specification of `http`/`https` commands
|
||||
(like an API definition) to outside tools so that they can use this to build better interactions
|
||||
(like an API definition) to outside tools so that they can use this to build better interactions
|
||||
over them (e.g., offer auto-complete).
|
||||
|
||||
Available formats to export in include:
|
||||
@ -2544,7 +2546,7 @@ All changes are recorded in the [change log](#change-log).
|
||||
#### Alternatives
|
||||
|
||||
- [httpcat](https://github.com/httpie/httpcat) — a lower-level sister utility of HTTPie for constructing raw HTTP requests on the command line
|
||||
- [curl](https://curl.haxx.se) — a "Swiss knife" command line tool and an exceptional library for transferring data with URLs.
|
||||
- [curl](https://curl.haxx.se) — a "Swiss knife" command line tool and an exceptional library for transferring data with URLs.
|
||||
|
||||
### Contributing
|
||||
|
||||
@ -2566,7 +2568,7 @@ HTTPie plays exceptionally well with the following tools:
|
||||
|
||||
BSD-3-Clause: [LICENSE](https://github.com/httpie/cli/blob/master/LICENSE).
|
||||
|
||||
### Authors
|
||||
### Authors
|
||||
|
||||
[Jakub Roztocil](https://roztocil.co) ([@jakubroztocil](https://twitter.com/jakubroztocil)) created HTTPie and [these fine people](https://github.com/httpie/cli/blob/master/AUTHORS.md) have contributed.
|
||||
|
||||
@ -2575,24 +2577,25 @@ Helpers to convert from other client tools:
|
||||
|
||||
### Contributing
|
||||
|
||||
See [CONTRIBUTING](https://github.com/httpie/httpie/blob/master/CONTRIBUTING.md).
|
||||
See [CONTRIBUTING](https://github.com/httpie/cli/blob/master/CONTRIBUTING.md).
|
||||
|
||||
### Security policy
|
||||
|
||||
See [github.com/httpie/httpie/security/policy](https://github.com/httpie/httpie/security/policy).
|
||||
See [github.com/httpie/cli/security/policy](https://github.com/httpie/cli/security/policy).
|
||||
|
||||
### Change log
|
||||
|
||||
See [CHANGELOG](https://github.com/httpie/httpie/blob/master/CHANGELOG.md).
|
||||
See [CHANGELOG](https://github.com/httpie/cli/blob/master/CHANGELOG.md).
|
||||
|
||||
### Artwork
|
||||
|
||||
- [README Animation](https://github.com/httpie/httpie/blob/master/docs/httpie-animation.gif) by [Allen Smith](https://github.com/loranallensmith).
|
||||
- [README Animation](https://github.com/httpie/cli/blob/master/docs/httpie-animation.gif) by [Allen Smith](https://github.com/loranallensmith).
|
||||
|
||||
### Licence
|
||||
|
||||
BSD-3-Clause: [LICENSE](https://github.com/httpie/httpie/blob/master/LICENSE).
|
||||
BSD-3-Clause: [LICENSE](https://github.com/httpie/cli/blob/master/LICENSE).
|
||||
|
||||
### Authors
|
||||
|
||||
[Jakub Roztocil](https://roztocil.co) ([@jakubroztocil](https://twitter.com/jakubroztocil)) created HTTPie and [these fine people](https://github.com/httpie/httpie/blob/master/AUTHORS.md) have contributed.
|
||||
[Jakub Roztocil](https://roztocil.co) ([@jakubroztocil](https://twitter.com/jakubroztocil)) created HTTPie and [these fine people](https://github.com/httpie/cli/blob/master/AUTHORS.md) have contributed.
|
||||
|
||||
|
@ -37,13 +37,13 @@ tools:
|
||||
package: https://packages.debian.org/sid/web/httpie
|
||||
commands:
|
||||
install:
|
||||
- curl -SsL https://packages.httpie.io/deb/KEY.gpg | apt-key add -
|
||||
- curl -SsL -o /etc/apt/sources.list.d/httpie.list https://packages.httpie.io/deb/httpie.list
|
||||
- apt update
|
||||
- apt install httpie
|
||||
- curl -SsL https://packages.httpie.io/deb/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/httpie.gpg
|
||||
# - curl -SsL -o /etc/apt/sources.list.d/httpie.list https://packages.httpie.io/deb/httpie.list
|
||||
- echo "deb [arch=amd64 signed-by=/usr/share/keyrings/httpie.gpg] https://packages.httpie.io/deb ./" | sudo tee /etc/apt/sources.list.d/httpie.list > /dev/null
|
||||
- sudo apt update
|
||||
- sudo apt install httpie
|
||||
upgrade:
|
||||
- apt update
|
||||
- apt upgrade httpie
|
||||
- sudo apt update && sudo apt upgrade httpie
|
||||
|
||||
brew-mac:
|
||||
title: Homebrew
|
||||
|
@ -3,7 +3,7 @@
|
||||
Welcome on the documentation part of the **HTTPie release process**.
|
||||
|
||||
- If you do not know HTTPie, have a look [here](https://httpie.io/cli).
|
||||
- If you are looking for HTTPie installation or upgrade instructions, then you can find all you need for your OS on [that page](https://httpie.io/docs#installation). In the case you do not find your OS, [let us know](https://github.com/httpie/httpie/issues/).
|
||||
- If you are looking for HTTPie installation or upgrade instructions, then you can find all you need for your OS on [that page](https://httpie.io/docs#installation). In the case you do not find your OS, [let us know](https://github.com/httpie/cli/issues/).
|
||||
- If you are looking for technical information about the HTTPie packaging, then you are at the good place.
|
||||
|
||||
## About
|
||||
@ -25,7 +25,7 @@ The overall release process starts simple:
|
||||
|
||||
## Company-specific tasks
|
||||
|
||||
- Blank the `master_and_released_docs_differ_after` value in [config.json](https://github.com/httpie/httpie/blob/master/docs/config.json).
|
||||
- Blank the `master_and_released_docs_differ_after` value in [config.json](https://github.com/httpie/cli/blob/master/docs/config.json).
|
||||
- Update the [contributors list](../contributors).
|
||||
- Update the HTTPie version bundled into [Termible](https://termible.io/) ([example](https://github.com/httpie/termible/pull/1)).
|
||||
|
||||
@ -44,4 +44,4 @@ A more complete state of deployment can be found on [repology](https://repology.
|
||||
| [Snapcraft](snapcraft/) | **HTTPie** |
|
||||
| [Windows — Chocolatey](windows-chocolatey/) | **HTTPie** |
|
||||
|
||||
:new: You do not find your system or you would like to see HTTPie supported on another OS? Then [let us know](https://github.com/httpie/httpie/issues/).
|
||||
:new: You do not find your system or you would like to see HTTPie supported on another OS? Then [let us know](https://github.com/httpie/cli/issues/).
|
||||
|
@ -13,7 +13,7 @@ We will discuss setting up the environment, installing development tools, instal
|
||||
|
||||
## Overall process
|
||||
|
||||
The brew deployment is completely automated, and only requires a trigger to [`Release on Homebrew`](https://github.com/httpie/httpie/actions/workflows/release-brew.yml) action
|
||||
The brew deployment is completely automated, and only requires a trigger to [`Release on Homebrew`](https://github.com/httpie/cli/actions/workflows/release-brew.yml) action
|
||||
from the release manager.
|
||||
|
||||
If it is needed to be done manually, the following command can be used:
|
||||
@ -26,6 +26,6 @@ which will bump the formula, and create a PR against the package index.
|
||||
|
||||
## Hacking
|
||||
|
||||
Make your changes, test the formula through the [`Test Brew Package`](https://github.com/httpie/httpie/actions/workflows/test-package-mac-brew.yml) action
|
||||
Make your changes, test the formula through the [`Test Brew Package`](https://github.com/httpie/cli/actions/workflows/test-package-mac-brew.yml) action
|
||||
and then finally submit your patch to [`homebrew-core`](https://github.com/Homebrew/homebrew-core`)
|
||||
|
||||
|
@ -6,7 +6,7 @@ class Httpie < Formula
|
||||
url "https://files.pythonhosted.org/packages/32/85/bb095699be20cc98731261cb80884e9458178f8fef2a38273530ce77c0a5/httpie-3.1.0.tar.gz"
|
||||
sha256 "2e4a2040b84a912e65c01fb34f7aafe88cad2a3af2da8c685ca65080f376feda"
|
||||
license "BSD-3-Clause"
|
||||
head "https://github.com/httpie/httpie.git", branch: "master"
|
||||
head "https://github.com/httpie/cli.git", branch: "master"
|
||||
|
||||
bottle do
|
||||
sha256 cellar: :any_skip_relocation, arm64_monterey: "9bb6e8c1ef5ba8b019ddedd7e908dd2174da695351aa9a238dfb28b0f57ef005"
|
||||
|
@ -7,7 +7,7 @@ pkgname=httpie
|
||||
pkgver=2.6.0
|
||||
pkgrel=1
|
||||
pkgdesc="human-friendly CLI HTTP client for the API era"
|
||||
url="https://github.com/httpie/httpie"
|
||||
url="https://github.com/httpie/cli"
|
||||
depends=('python-defusedxml'
|
||||
'python-pygments'
|
||||
'python-pysocks'
|
||||
@ -22,7 +22,7 @@ conflicts=(python-httpie)
|
||||
replaces=(python-httpie python2-httpie)
|
||||
license=('BSD')
|
||||
arch=('any')
|
||||
source=($pkgname-$pkgver.tar.gz::"https://github.com/httpie/httpie/archive/$pkgver.tar.gz")
|
||||
source=($pkgname-$pkgver.tar.gz::"https://github.com/httpie/cli/archive/$pkgver.tar.gz")
|
||||
sha256sums=('3bcd9a8cb2b11299da12d3af36c095c6d4b665e41c395898a07f1ae4d99fc14a')
|
||||
|
||||
build() {
|
||||
|
@ -17,7 +17,7 @@ command (due to the underlying `httpie cli plugins` interface) explicitly depend
|
||||
|
||||
## Overall process
|
||||
|
||||
The [`Release as Standalone Linux Binary`](https://github.com/httpie/httpie/actions/workflows/release-linux-standalone.yml) will be automatically
|
||||
The [`Release as Standalone Linux Binary`](https://github.com/httpie/cli/actions/workflows/release-linux-standalone.yml) will be automatically
|
||||
triggered when a new release is created, and it will submit the `.deb` package as a release asset.
|
||||
|
||||
For making that asset available for all debian users, the release manager needs to go to the [`httpie/debian.httpie.io`](https://github.com/httpie/debian.httpie.io) repo
|
||||
|
@ -15,7 +15,7 @@ The current maintainer is [Miro Hrončok](https://github.com/hroncok).
|
||||
|
||||
## Overall process
|
||||
|
||||
We added the [.packit.yaml](https://github.com/httpie/httpie/blob/master/.packit.yaml) local file.
|
||||
We added the [.packit.yaml](https://github.com/httpie/cli/blob/master/.packit.yaml) local file.
|
||||
It unlocks real-time Fedora checks on pull requests and new releases.
|
||||
|
||||
So there is nothing to do on our side: `Packit` will see the new release and open a pull request [there](https://src.fedoraproject.org/rpms/httpie). Then, the Fedora maintainer will review and merge.
|
||||
|
@ -5,7 +5,7 @@ Summary: A Curl-like tool for humans
|
||||
|
||||
License: BSD
|
||||
URL: https://httpie.org/
|
||||
Source0: https://github.com/httpie/httpie/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
Source0: https://github.com/httpie/cli/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
|
@ -19,7 +19,7 @@ Open a pull request to update the [downstream file](https://github.com/macports/
|
||||
|
||||
```bash
|
||||
# Download the archive
|
||||
$ wget https://api.github.com/repos/httpie/httpie/tarball/2.5.0
|
||||
$ wget https://api.github.com/repos/httpie/cli/tarball/2.5.0
|
||||
|
||||
# Size
|
||||
$ stat --printf="%s\n" 2.5.0
|
||||
|
@ -13,7 +13,7 @@ We will discuss setting up the environment, installing development tools, instal
|
||||
|
||||
## Overall process
|
||||
|
||||
Trigger the [`Release on Snap`](https://github.com/httpie/httpie/actions/workflows/release-snap.yml) action, which will
|
||||
Trigger the [`Release on Snap`](https://github.com/httpie/cli/actions/workflows/release-snap.yml) action, which will
|
||||
create a snap package for HTTPie and then push it to Snap Store in the following channels:
|
||||
|
||||
- Edge
|
||||
@ -37,7 +37,7 @@ From inside the container:
|
||||
|
||||
```bash
|
||||
# Clone
|
||||
git clone --depth=1 https://github.com/httpie/httpie.git
|
||||
git clone --depth=1 https://github.com/httpie/cli.git
|
||||
cd httpie
|
||||
|
||||
# Build
|
||||
|
@ -14,7 +14,7 @@ We will discuss setting up the environment, installing development tools, instal
|
||||
## Overall process
|
||||
|
||||
After having successfully [built and tested](#hacking) the package, either trigger the
|
||||
[`Release on Chocolatey`](https://github.com/httpie/httpie/actions/workflows/release-choco.yml) action
|
||||
[`Release on Chocolatey`](https://github.com/httpie/cli/actions/workflows/release-choco.yml) action
|
||||
to push it to the `Chocolatey` store or use the CLI:
|
||||
|
||||
```bash
|
||||
@ -29,7 +29,7 @@ sets of reviews (some of them are done manually).
|
||||
|
||||
```bash
|
||||
# Clone
|
||||
git clone --depth=1 https://github.com/httpie/httpie.git
|
||||
git clone --depth=1 https://github.com/httpie/cli.git
|
||||
cd httpie/docs/packaging/windows-chocolatey
|
||||
|
||||
# Build
|
||||
|
@ -2,7 +2,7 @@
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>httpie</id>
|
||||
<version>3.2.1</version>
|
||||
<version>3.2.2</version>
|
||||
<summary>Modern, user-friendly command-line HTTP client for the API era</summary>
|
||||
<description>
|
||||
HTTPie *aitch-tee-tee-pie* is a user-friendly command-line HTTP client for the API era.
|
||||
@ -30,16 +30,16 @@ Main features:
|
||||
<authors>HTTPie</authors>
|
||||
<owners>jakubroztocil</owners>
|
||||
<copyright>2012-2022 Jakub Roztocil</copyright>
|
||||
<licenseUrl>https://raw.githubusercontent.com/httpie/httpie/master/LICENSE</licenseUrl>
|
||||
<licenseUrl>https://raw.githubusercontent.com/httpie/cli/master/LICENSE</licenseUrl>
|
||||
<iconUrl>https://pie-assets.s3.eu-central-1.amazonaws.com/LogoIcons/GB.png</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<releaseNotes>See the [changelog](https://github.com/httpie/httpie/releases/tag/3.2.0).</releaseNotes>
|
||||
<releaseNotes>See the [changelog](https://github.com/httpie/cli/releases/tag/3.2.2).</releaseNotes>
|
||||
<tags>httpie http https rest api client curl python ssl cli foss oss url</tags>
|
||||
<projectUrl>https://httpie.io</projectUrl>
|
||||
<packageSourceUrl>https://github.com/httpie/httpie/tree/master/docs/packaging/windows-chocolatey</packageSourceUrl>
|
||||
<projectSourceUrl>https://github.com/httpie/httpie</projectSourceUrl>
|
||||
<packageSourceUrl>https://github.com/httpie/cli/tree/master/docs/packaging/windows-chocolatey</packageSourceUrl>
|
||||
<projectSourceUrl>https://github.com/httpie/cli</projectSourceUrl>
|
||||
<docsUrl>https://httpie.io/docs</docsUrl>
|
||||
<bugTrackerUrl>https://github.com/httpie/httpie/issues</bugTrackerUrl>
|
||||
<bugTrackerUrl>https://github.com/httpie/cli/issues</bugTrackerUrl>
|
||||
<dependencies>
|
||||
<dependency id="python3" version="3.7" />
|
||||
</dependencies>
|
||||
|
@ -112,3 +112,8 @@ complete -c http -l version -d 'Show version'
|
||||
complete -c http -l traceback -d 'Prints exception traceback should one occur'
|
||||
complete -c http -l default-scheme -x -d 'The default scheme to use'
|
||||
complete -c http -l debug -d 'Show debugging output'
|
||||
|
||||
|
||||
# Alias for https to http
|
||||
|
||||
complete -c https -w http
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" This file is auto-generated from the parser declaration in httpie/cli/definition.py by extras/scripts/generate_man_pages.py.
|
||||
.TH http 1 "2022-05-06" "HTTPie 3.2.1" "HTTPie Manual"
|
||||
.TH http 1 "2024-11-01" "HTTPie 3.2.4" "HTTPie Manual"
|
||||
.SH NAME
|
||||
http
|
||||
.SH SYNOPSIS
|
||||
@ -399,7 +399,7 @@ The authentication mechanism to be used. Defaults to \[dq]basic\[dq].
|
||||
|
||||
\[dq]bearer\[dq]: Bearer HTTP Auth
|
||||
|
||||
For finding out all available authentication types in your system, try:
|
||||
To see all available auth types on your system, including ones installed via plugins, run:
|
||||
|
||||
$ http \fB\,--auth-type\/\fR
|
||||
|
||||
@ -510,10 +510,12 @@ are shown here).
|
||||
|
||||
|
||||
|
||||
A string in the OpenSSL cipher list format. By default, the following
|
||||
is used:
|
||||
A string in the OpenSSL cipher list format.
|
||||
|
||||
|
||||
See `http \fB\,--help\/\fR` for the default ciphers list on you system.
|
||||
|
||||
|
||||
ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDH+AESGCM:DH+AESGCM:ECDH+AES:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!eNULL:!MD5:!DSS
|
||||
|
||||
|
||||
|
||||
@ -595,4 +597,4 @@ For every \fB\,--OPTION\/\fR there is also a \fB\,--no-OPTION\/\fR that reverts
|
||||
to its default value.
|
||||
|
||||
Suggestions and bug reports are greatly appreciated:
|
||||
https://github.com/httpie/httpie/issues
|
||||
https://github.com/httpie/cli/issues
|
@ -1,5 +1,5 @@
|
||||
.\" This file is auto-generated from the parser declaration in httpie/manager/cli.py by extras/scripts/generate_man_pages.py.
|
||||
.TH httpie 1 "2022-05-06" "HTTPie 3.2.1" "HTTPie Manual"
|
||||
.TH httpie 1 "2024-11-01" "HTTPie 3.2.4" "HTTPie Manual"
|
||||
.SH NAME
|
||||
httpie
|
||||
.SH SYNOPSIS
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" This file is auto-generated from the parser declaration in httpie/cli/definition.py by extras/scripts/generate_man_pages.py.
|
||||
.TH https 1 "2022-05-06" "HTTPie 3.2.1" "HTTPie Manual"
|
||||
.TH https 1 "2024-11-01" "HTTPie 3.2.4" "HTTPie Manual"
|
||||
.SH NAME
|
||||
https
|
||||
.SH SYNOPSIS
|
||||
@ -399,7 +399,7 @@ The authentication mechanism to be used. Defaults to \[dq]basic\[dq].
|
||||
|
||||
\[dq]bearer\[dq]: Bearer HTTP Auth
|
||||
|
||||
For finding out all available authentication types in your system, try:
|
||||
To see all available auth types on your system, including ones installed via plugins, run:
|
||||
|
||||
$ http \fB\,--auth-type\/\fR
|
||||
|
||||
@ -510,10 +510,12 @@ are shown here).
|
||||
|
||||
|
||||
|
||||
A string in the OpenSSL cipher list format. By default, the following
|
||||
is used:
|
||||
A string in the OpenSSL cipher list format.
|
||||
|
||||
|
||||
See `http \fB\,--help\/\fR` for the default ciphers list on you system.
|
||||
|
||||
|
||||
ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDH+AESGCM:DH+AESGCM:ECDH+AES:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!eNULL:!MD5:!DSS
|
||||
|
||||
|
||||
|
||||
@ -595,4 +597,4 @@ For every \fB\,--OPTION\/\fR there is also a \fB\,--no-OPTION\/\fR that reverts
|
||||
to its default value.
|
||||
|
||||
Suggestions and bug reports are greatly appreciated:
|
||||
https://github.com/httpie/httpie/issues
|
||||
https://github.com/httpie/cli/issues
|
@ -7,13 +7,13 @@ This directory contains the build scripts for creating:
|
||||
- A self-contained binary executable for the HTTPie itself
|
||||
- `httpie.deb` and `httpie.rpm` packages for Debian and Fedora.
|
||||
|
||||
The process of constructing them are fully automated, and can be easily done through the [`Release as Standalone Linux Package`](https://github.com/httpie/httpie/actions/workflows/release-linux-standalone.yml)
|
||||
The process of constructing them are fully automated, and can be easily done through the [`Release as Standalone Linux Package`](https://github.com/httpie/cli/actions/workflows/release-linux-standalone.yml)
|
||||
action. Once it finishes, the release artifacts will be attached in the summary page of the triggered run.
|
||||
|
||||
|
||||
## Hacking
|
||||
|
||||
The main entry point for the package builder is the [`build.py`](https://github.com/httpie/httpie/blob/master/extras/packaging/linux/build.py). It
|
||||
The main entry point for the package builder is the [`build.py`](https://github.com/httpie/cli/blob/master/extras/packaging/linux/build.py). It
|
||||
contains 2 major methods:
|
||||
|
||||
- `build_binaries`, for the self-contained executables
|
||||
@ -39,7 +39,7 @@ Since the `httpie` depends on having a pip executable, we explicitly depend on t
|
||||
|
||||
### Docker Image
|
||||
|
||||
This directory also contains a [docker image](https://github.com/httpie/httpie/blob/master/extras/packaging/linux/Dockerfile) which helps
|
||||
This directory also contains a [docker image](https://github.com/httpie/cli/blob/master/extras/packaging/linux/Dockerfile) which helps
|
||||
building our standalone binaries in an isolated environment with the lowest possible library versions. This is important, since even though
|
||||
the executables are standalone they still depend on some main system C libraries (like `glibc`) so we need to create our executables inside
|
||||
an environment with a very old (but not deprecated) glibc version. It makes us soundproof for all active Ubuntu/Debian versions.
|
||||
|
@ -28,7 +28,7 @@ on both of them. It will compare the results and print it as a markdown table:
|
||||
| Geometric mean | (ref) | 1.10x faster |
|
||||
|
||||
If your `master` branch is not up-to-date, you can get a fresh clone by passing
|
||||
`--fresh` option. This way, the benchmark runner will clone the `httpie/httpie`
|
||||
`--fresh` option. This way, the benchmark runner will clone the `httpie/cli`
|
||||
repo from `GitHub` and use it as the baseline.
|
||||
|
||||
You can customize these branches by passing `--local-repo`/`--target-branch`,
|
||||
|
@ -50,7 +50,7 @@ from typing import (IO, Dict, Generator, Iterable, List, Optional,
|
||||
BENCHMARK_SCRIPT = Path(__file__).parent / 'benchmarks.py'
|
||||
CURRENT_REPO = Path(__file__).parent.parent.parent
|
||||
|
||||
GITHUB_URL = 'https://github.com/httpie/httpie.git'
|
||||
GITHUB_URL = 'https://github.com/httpie/cli.git'
|
||||
TARGET_BRANCH = 'master'
|
||||
|
||||
# Additional dependencies for --complex
|
||||
|
@ -1,20 +1,25 @@
|
||||
import os
|
||||
import re
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Optional, Iterator, Iterable
|
||||
|
||||
|
||||
# So that httpie.cli.definition can provide man-page-specific output. Must be set before importing httpie.
|
||||
os.environ['HTTPIE_BUILDING_MAN_PAGES'] = '1'
|
||||
|
||||
import httpie
|
||||
from httpie.cli.definition import options as core_options
|
||||
from httpie.cli.definition import options as core_options, IS_MAN_PAGE
|
||||
from httpie.cli.options import ParserSpec
|
||||
from httpie.manager.cli import options as manager_options
|
||||
from httpie.output.ui.rich_help import OptionsHighlighter, to_usage
|
||||
from httpie.output.ui.rich_utils import render_as_string
|
||||
from httpie.utils import split_iterable
|
||||
|
||||
|
||||
# Escape certain characters so they are rendered properly on
|
||||
# all terminals.
|
||||
# https://man7.org/linux/man-pages/man7/groff_char.7.html
|
||||
assert IS_MAN_PAGE, 'CLI definition does not understand we’re building man pages'
|
||||
|
||||
# Escape certain characters, so they are rendered properly on all terminals.
|
||||
# <https://man7.org/linux/man-pages/man7/groff_char.7.html>
|
||||
ESCAPE_MAP = {
|
||||
'"': '\[dq]',
|
||||
"'": '\[aq]',
|
||||
@ -32,6 +37,7 @@ OPTION_HIGHLIGHT_RE = re.compile(
|
||||
OptionsHighlighter.highlights[0]
|
||||
)
|
||||
|
||||
|
||||
class ManPageBuilder:
|
||||
def __init__(self):
|
||||
self.source = []
|
||||
@ -125,7 +131,7 @@ def to_man_page(program_name: str, spec: ParserSpec, *, is_top_level_cmd: bool =
|
||||
|
||||
with builder.section('SYNOPSIS'):
|
||||
# `http` and `https` are commands that can be directly used, so they can have
|
||||
# have a valid usage. But `httpie` is a top-level command with multiple sub commands,
|
||||
# a valid usage. But `httpie` is a top-level command with multiple sub commands,
|
||||
# so for the synopsis we'll only reference the `httpie` name.
|
||||
if is_top_level_cmd:
|
||||
synopsis = program_name
|
||||
@ -153,7 +159,7 @@ def to_man_page(program_name: str, spec: ParserSpec, *, is_top_level_cmd: bool =
|
||||
if raw_arg.get('is_positional'):
|
||||
# In case of positional arguments, metavar is always equal
|
||||
# to the list of options (e.g `METHOD`).
|
||||
metavar = None
|
||||
metavar = None
|
||||
builder.add_options(raw_arg['options'], metavar=metavar)
|
||||
|
||||
desc = builder.format_desc(raw_arg.get('description', ''))
|
||||
@ -178,6 +184,5 @@ def main() -> None:
|
||||
stream.write(to_man_page(program_name, spec, **config))
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -3,7 +3,7 @@ HTTPie: modern, user-friendly command-line HTTP client for the API era.
|
||||
|
||||
"""
|
||||
|
||||
__version__ = '3.2.2'
|
||||
__date__ = '2022-05-06'
|
||||
__version__ = '3.2.4'
|
||||
__date__ = '2024-11-01'
|
||||
__author__ = 'Jakub Roztocil'
|
||||
__licence__ = 'BSD'
|
||||
|
@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import textwrap
|
||||
from argparse import FileType
|
||||
|
||||
@ -22,6 +23,12 @@ from httpie.plugins.builtin import BuiltinAuthPlugin
|
||||
from httpie.plugins.registry import plugin_manager
|
||||
from httpie.ssl_ import AVAILABLE_SSL_VERSION_ARG_MAPPING, DEFAULT_SSL_CIPHERS_STRING
|
||||
|
||||
|
||||
# Man pages are static (built when making a release).
|
||||
# We use this check to not include generated, system-specific information there (e.g., default --ciphers).
|
||||
IS_MAN_PAGE = bool(os.environ.get('HTTPIE_BUILDING_MAN_PAGES'))
|
||||
|
||||
|
||||
options = ParserSpec(
|
||||
'http',
|
||||
description=f'{__doc__.strip()} <https://httpie.io>',
|
||||
@ -30,12 +37,11 @@ options = ParserSpec(
|
||||
to its default value.
|
||||
|
||||
Suggestions and bug reports are greatly appreciated:
|
||||
https://github.com/httpie/httpie/issues
|
||||
https://github.com/httpie/cli/issues
|
||||
""",
|
||||
source_file=__file__
|
||||
)
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Positional arguments.
|
||||
#######################################################################
|
||||
@ -234,6 +240,7 @@ processing_options.add_argument(
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Output processing
|
||||
#######################################################################
|
||||
@ -610,6 +617,7 @@ sessions.add_argument(
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Authentication
|
||||
#######################################################################
|
||||
@ -630,7 +638,7 @@ def format_auth_help(auth_plugins_mapping, *, isolation_mode: bool = False):
|
||||
if issubclass(auth_plugin, BuiltinAuthPlugin)
|
||||
]
|
||||
text += '\n'
|
||||
text += 'For finding out all available authentication types in your system, try:\n\n'
|
||||
text += 'To see all available auth types on your system, including ones installed via plugins, run:\n\n'
|
||||
text += ' $ http --auth-type'
|
||||
|
||||
auth_types = '\n\n '.join(
|
||||
@ -646,7 +654,7 @@ def format_auth_help(auth_plugins_mapping, *, isolation_mode: bool = False):
|
||||
''
|
||||
if not plugin.description
|
||||
else '\n '
|
||||
+ ('\n '.join(textwrap.wrap(plugin.description)))
|
||||
+ ('\n '.join(textwrap.wrap(plugin.description)))
|
||||
),
|
||||
)
|
||||
for plugin in auth_plugins
|
||||
@ -826,23 +834,36 @@ ssl.add_argument(
|
||||
|
||||
""",
|
||||
)
|
||||
|
||||
CIPHERS_CURRENT_DEFAULTS = (
|
||||
"""
|
||||
See `http --help` for the default ciphers list on you system.
|
||||
|
||||
"""
|
||||
if IS_MAN_PAGE else
|
||||
f"""
|
||||
By default, the following ciphers are used on your system:
|
||||
|
||||
{DEFAULT_SSL_CIPHERS_STRING}
|
||||
|
||||
"""
|
||||
)
|
||||
ssl.add_argument(
|
||||
'--ciphers',
|
||||
short_help='A string in the OpenSSL cipher list format.',
|
||||
help=f"""
|
||||
|
||||
A string in the OpenSSL cipher list format. By default, the following
|
||||
ciphers are used on your system:
|
||||
A string in the OpenSSL cipher list format.
|
||||
|
||||
{DEFAULT_SSL_CIPHERS_STRING}
|
||||
{CIPHERS_CURRENT_DEFAULTS}
|
||||
|
||||
""",
|
||||
"""
|
||||
)
|
||||
ssl.add_argument(
|
||||
'--cert',
|
||||
default=None,
|
||||
type=readable_file_arg,
|
||||
short_help='Specifys a local cert to use as client side SSL certificate.',
|
||||
short_help='Specifies a local cert to use as the client-side SSL certificate.',
|
||||
help="""
|
||||
You can specify a local cert to use as client side SSL certificate.
|
||||
This file may either contain both private key and certificate or you may
|
||||
|
@ -10,6 +10,7 @@ from urllib.parse import urlparse, urlunparse
|
||||
import requests
|
||||
# noinspection PyPackageRequirements
|
||||
import urllib3
|
||||
from urllib3.util import SKIP_HEADER, SKIPPABLE_HEADERS
|
||||
|
||||
from . import __version__
|
||||
from .adapters import HTTPieHTTPAdapter
|
||||
@ -142,7 +143,7 @@ def collect_messages(
|
||||
# noinspection PyProtectedMember
|
||||
@contextmanager
|
||||
def max_headers(limit):
|
||||
# <https://github.com/httpie/httpie/issues/802>
|
||||
# <https://github.com/httpie/cli/issues/802>
|
||||
# noinspection PyUnresolvedReferences
|
||||
orig = http.client._MAXHEADERS
|
||||
http.client._MAXHEADERS = limit or float('Inf')
|
||||
@ -198,8 +199,12 @@ def finalize_headers(headers: HTTPHeadersDict) -> HTTPHeadersDict:
|
||||
# Also, requests raises `InvalidHeader` for leading spaces.
|
||||
value = value.strip()
|
||||
if isinstance(value, str):
|
||||
# See <https://github.com/httpie/httpie/issues/212>
|
||||
# See <https://github.com/httpie/cli/issues/212>
|
||||
value = value.encode()
|
||||
elif name.lower() in SKIPPABLE_HEADERS:
|
||||
# Some headers get overwritten by urllib3 when set to `None`
|
||||
# and should be replaced with the `SKIP_HEADER` constant.
|
||||
value = SKIP_HEADER
|
||||
final_headers.add(name, value)
|
||||
return final_headers
|
||||
|
||||
@ -376,7 +381,7 @@ def ensure_path_as_is(orig_url: str, prepped_url: str) -> str:
|
||||
untouched because other (welcome) processing on the URL might have
|
||||
taken place.
|
||||
|
||||
<https://github.com/httpie/httpie/issues/895>
|
||||
<https://github.com/httpie/cli/issues/895>
|
||||
|
||||
|
||||
<https://ec.haxx.se/http/http-basics#path-as-is>
|
||||
|
@ -1,8 +1,9 @@
|
||||
import sys
|
||||
from ssl import SSLContext
|
||||
from typing import Any, Optional, Iterable
|
||||
|
||||
from httpie.cookies import HTTPieCookiePolicy
|
||||
from http import cookiejar # noqa
|
||||
from http import cookiejar # noqa
|
||||
|
||||
|
||||
# Request does not carry the original policy attached to the
|
||||
@ -10,7 +11,6 @@ from http import cookiejar # noqa
|
||||
# policy. <https://github.com/psf/requests/issues/5449>
|
||||
cookiejar.DefaultCookiePolicy = HTTPieCookiePolicy
|
||||
|
||||
|
||||
is_windows = 'win32' in str(sys.platform).lower()
|
||||
is_frozen = getattr(sys, 'frozen', False)
|
||||
|
||||
@ -66,7 +66,6 @@ except ImportError:
|
||||
res = instance.__dict__[self.name] = self.func(instance)
|
||||
return res
|
||||
|
||||
|
||||
# importlib_metadata was a provisional module, so the APIs changed quite a few times
|
||||
# between 3.8-3.10. It was also not included in the standard library until 3.8, so
|
||||
# we install the backport for <3.8.
|
||||
@ -100,3 +99,15 @@ def get_dist_name(entry_point: importlib_metadata.EntryPoint) -> Optional[str]:
|
||||
return None
|
||||
else:
|
||||
return metadata.get('name')
|
||||
|
||||
|
||||
def ensure_default_certs_loaded(ssl_context: SSLContext) -> None:
|
||||
"""
|
||||
Workaround for a bug in Requests 2.32.3
|
||||
|
||||
See <https://github.com/httpie/cli/issues/1583>
|
||||
|
||||
"""
|
||||
if hasattr(ssl_context, 'load_default_certs'):
|
||||
if not ssl_context.get_ca_certs():
|
||||
ssl_context.load_default_certs()
|
||||
|
@ -217,7 +217,7 @@ class Downloader:
|
||||
assert not self.status.time_started
|
||||
|
||||
# FIXME: some servers still might sent Content-Encoding: gzip
|
||||
# <https://github.com/httpie/httpie/issues/423>
|
||||
# <https://github.com/httpie/cli/issues/423>
|
||||
try:
|
||||
total_size = int(final_response.headers['Content-Length'])
|
||||
except (KeyError, ValueError, TypeError):
|
||||
|
@ -1,6 +1,7 @@
|
||||
from time import monotonic
|
||||
|
||||
import requests
|
||||
from urllib3.util import SKIP_HEADER, SKIPPABLE_HEADERS
|
||||
|
||||
from enum import Enum, auto
|
||||
from typing import Iterable, Union, NamedTuple
|
||||
@ -152,6 +153,7 @@ class HTTPRequest(HTTPMessage):
|
||||
headers = [
|
||||
f'{name}: {value if isinstance(value, str) else value.decode()}'
|
||||
for name, value in headers.items()
|
||||
if not (name.lower() in SKIPPABLE_HEADERS and value == SKIP_HEADER)
|
||||
]
|
||||
|
||||
headers.insert(0, request_line)
|
||||
|
@ -4,23 +4,22 @@ import subprocess
|
||||
import os
|
||||
from httpie.context import Environment
|
||||
|
||||
|
||||
MAN_COMMAND = 'man'
|
||||
NO_MAN_PAGES = os.getenv('HTTPIE_NO_MAN_PAGES', False)
|
||||
|
||||
# On some systems, HTTP(n) might exist but we are only
|
||||
# interested in HTTP(1).
|
||||
#
|
||||
# For more information on man page sections: https://unix.stackexchange.com/a/138643
|
||||
|
||||
# On some systems, HTTP(n) might exist, but we are only interested in HTTP(1).
|
||||
# For more information on man page sections: <https://unix.stackexchange.com/a/138643>
|
||||
MAN_PAGE_SECTION = '1'
|
||||
|
||||
|
||||
def is_available(program: str) -> bool:
|
||||
"""Check whether HTTPie's man pages are available in this system."""
|
||||
"""
|
||||
Check whether `program`'s man pages are available on this system.
|
||||
|
||||
"""
|
||||
if NO_MAN_PAGES or os.system == 'nt':
|
||||
return False
|
||||
|
||||
try:
|
||||
process = subprocess.run(
|
||||
[MAN_COMMAND, MAN_PAGE_SECTION, program],
|
||||
@ -29,7 +28,7 @@ def is_available(program: str) -> bool:
|
||||
stderr=subprocess.DEVNULL
|
||||
)
|
||||
except Exception:
|
||||
# There might be some errors outside of the process, e.g
|
||||
# There might be some errors outside the process, e.g
|
||||
# a permission error to execute something that is not an
|
||||
# executable.
|
||||
return False
|
||||
@ -38,8 +37,10 @@ def is_available(program: str) -> bool:
|
||||
|
||||
|
||||
def display_for(env: Environment, program: str) -> None:
|
||||
"""Display the man page for the given command (http/https)."""
|
||||
"""
|
||||
Open the system man page for the given command (http/https/httpie).
|
||||
|
||||
"""
|
||||
subprocess.run(
|
||||
[MAN_COMMAND, MAN_PAGE_SECTION, program],
|
||||
stdout=env.stdout,
|
||||
|
@ -19,7 +19,7 @@ class HTTPBasicAuth(requests.auth.HTTPBasicAuth):
|
||||
"""
|
||||
Override username/password serialization to allow unicode.
|
||||
|
||||
See https://github.com/httpie/httpie/issues/212
|
||||
See https://github.com/httpie/cli/issues/212
|
||||
|
||||
"""
|
||||
# noinspection PyTypeChecker
|
||||
|
@ -1,13 +1,15 @@
|
||||
import ssl
|
||||
from typing import NamedTuple, Optional
|
||||
|
||||
from httpie.adapters import HTTPAdapter
|
||||
# noinspection PyPackageRequirements
|
||||
from urllib3.util.ssl_ import (
|
||||
create_urllib3_context,
|
||||
resolve_ssl_version,
|
||||
)
|
||||
|
||||
from .adapters import HTTPAdapter
|
||||
from .compat import ensure_default_certs_loaded
|
||||
|
||||
|
||||
SSL_VERSION_ARG_MAPPING = {
|
||||
'ssl2.3': 'PROTOCOL_SSLv23',
|
||||
@ -32,7 +34,7 @@ class HTTPieCertificate(NamedTuple):
|
||||
def to_raw_cert(self):
|
||||
"""Synthesize a requests-compatible (2-item tuple of cert and key file)
|
||||
object from HTTPie's internal representation of a certificate."""
|
||||
return (self.cert_file, self.key_file)
|
||||
return self.cert_file, self.key_file
|
||||
|
||||
|
||||
class HTTPieHTTPSAdapter(HTTPAdapter):
|
||||
@ -71,7 +73,7 @@ class HTTPieHTTPSAdapter(HTTPAdapter):
|
||||
ssl_version: str = None,
|
||||
ciphers: str = None,
|
||||
) -> 'ssl.SSLContext':
|
||||
return create_urllib3_context(
|
||||
ssl_context = create_urllib3_context(
|
||||
ciphers=ciphers,
|
||||
ssl_version=resolve_ssl_version(ssl_version),
|
||||
# Since we are using a custom SSL context, we need to pass this
|
||||
@ -79,6 +81,8 @@ class HTTPieHTTPSAdapter(HTTPAdapter):
|
||||
# in `super().cert_verify()`.
|
||||
cert_reqs=ssl.CERT_REQUIRED if verify else ssl.CERT_NONE
|
||||
)
|
||||
ensure_default_certs_loaded(ssl_context)
|
||||
return ssl_context
|
||||
|
||||
@classmethod
|
||||
def get_default_ciphers_names(cls):
|
||||
@ -101,5 +105,5 @@ def _is_key_file_encrypted(key_file):
|
||||
|
||||
# We used to import the default set of TLS ciphers from urllib3, but they removed it.
|
||||
# Instead, now urllib3 uses the list of ciphers configured by the system.
|
||||
# <https://github.com/httpie/httpie/pull/1501>
|
||||
# <https://github.com/httpie/cli/pull/1501>
|
||||
DEFAULT_SSL_CIPHERS_STRING = ':'.join(HTTPieHTTPSAdapter.get_default_ciphers_names())
|
||||
|
92
setup.cfg
92
setup.cfg
@ -1,6 +1,6 @@
|
||||
# Please keep all characters in this file in ASCII
|
||||
# distutils uses system's locale to interpret it and not everybody
|
||||
# uses UTF-8. See https://github.com/httpie/httpie/issues/1039
|
||||
# uses UTF-8. See https://github.com/httpie/cli/issues/1039
|
||||
# for an example
|
||||
[wheel]
|
||||
|
||||
@ -12,9 +12,99 @@ norecursedirs = tests/fixtures
|
||||
addopts = --tb=native --doctest-modules --verbose
|
||||
xfail_strict = True
|
||||
|
||||
[metadata]
|
||||
name = httpie
|
||||
version = attr: httpie.__version__
|
||||
author = Jakub Roztocil
|
||||
author_email = jakub@roztocil.co
|
||||
license = BSD
|
||||
description = HTTPie: modern, user-friendly command-line HTTP client for the API era.
|
||||
url = https://httpie.io/
|
||||
long_description = file: README.md
|
||||
long_description_content_type = text/markdown
|
||||
classifiers =
|
||||
Development Status :: 5 - Production/Stable
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3 :: Only
|
||||
Environment :: Console
|
||||
Intended Audience :: Developers
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: BSD License
|
||||
Topic :: Internet :: WWW/HTTP
|
||||
Topic :: Software Development
|
||||
Topic :: System :: Networking
|
||||
Topic :: Terminals
|
||||
Topic :: Text Processing
|
||||
Topic :: Utilities
|
||||
project_urls =
|
||||
GitHub = https://github.com/httpie/cli
|
||||
Twitter = https://twitter.com/httpie
|
||||
Discord = https://httpie.io/discord
|
||||
Documentation = https://httpie.io/docs
|
||||
Online Demo = https://httpie.io/run
|
||||
|
||||
|
||||
[options]
|
||||
packages = find:
|
||||
install_requires =
|
||||
pip
|
||||
charset_normalizer>=2.0.0
|
||||
defusedxml>=0.6.0
|
||||
requests[socks] >=2.22.0
|
||||
Pygments>=2.5.2
|
||||
requests-toolbelt>=0.9.1
|
||||
multidict>=4.7.0
|
||||
setuptools
|
||||
importlib-metadata>=1.4.0; python_version<"3.8"
|
||||
rich>=9.10.0
|
||||
colorama>=0.2.4; sys_platform=="win32"
|
||||
python_requires = >=3.7
|
||||
|
||||
|
||||
[flake8]
|
||||
# <https://flake8.pycqa.org/en/latest/user/error-codes.html>
|
||||
# E501 - line too long
|
||||
# W503 - line break before binary operator
|
||||
ignore = E501,W503
|
||||
|
||||
[options.packages.find]
|
||||
include =
|
||||
httpie
|
||||
httpie.*
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
http = httpie.__main__:main
|
||||
https = httpie.__main__:main
|
||||
httpie = httpie.manager.__main__:main
|
||||
|
||||
[options.extras_require]
|
||||
dev =
|
||||
pytest
|
||||
pytest-httpbin>=0.0.6
|
||||
responses
|
||||
pytest-mock
|
||||
werkzeug<2.1.0
|
||||
flake8
|
||||
flake8-comprehensions
|
||||
flake8-deprecated
|
||||
flake8-mutable
|
||||
flake8-tuple
|
||||
pyopenssl
|
||||
pytest-cov
|
||||
pyyaml
|
||||
twine
|
||||
wheel
|
||||
Jinja2
|
||||
test =
|
||||
pytest
|
||||
pytest-httpbin>=0.0.6
|
||||
responses
|
||||
pytest-mock
|
||||
werkzeug<2.1.0
|
||||
|
||||
[options.data_files]
|
||||
share/man/man1 =
|
||||
extras/man/http.1
|
||||
extras/man/https.1
|
||||
extras/man/httpie.1
|
||||
|
123
setup.py
123
setup.py
@ -1,122 +1,3 @@
|
||||
# This is purely the result of trial and error.
|
||||
from setuptools import setup
|
||||
|
||||
import sys
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
import httpie
|
||||
|
||||
|
||||
# Note: keep requirements here to ease distributions packaging
|
||||
tests_require = [
|
||||
'pytest',
|
||||
'pytest-httpbin>=0.0.6',
|
||||
'pytest-lazy-fixture>=0.0.6',
|
||||
'responses',
|
||||
'pytest-mock',
|
||||
'werkzeug<2.1.0'
|
||||
]
|
||||
dev_require = [
|
||||
*tests_require,
|
||||
'flake8',
|
||||
'flake8-comprehensions',
|
||||
'flake8-deprecated',
|
||||
'flake8-mutable',
|
||||
'flake8-tuple',
|
||||
'pyopenssl',
|
||||
'pytest-cov',
|
||||
'pyyaml',
|
||||
'twine',
|
||||
'wheel',
|
||||
'Jinja2'
|
||||
]
|
||||
install_requires = [
|
||||
'pip',
|
||||
'charset_normalizer>=2.0.0',
|
||||
'defusedxml>=0.6.0',
|
||||
'requests[socks]>=2.22.0',
|
||||
'Pygments>=2.5.2',
|
||||
'requests-toolbelt>=0.9.1',
|
||||
'multidict>=4.7.0',
|
||||
'setuptools',
|
||||
'importlib-metadata>=1.4.0; python_version < "3.8"',
|
||||
'rich>=9.10.0'
|
||||
]
|
||||
install_requires_win_only = [
|
||||
'colorama>=0.2.4',
|
||||
]
|
||||
|
||||
# Conditional dependencies:
|
||||
|
||||
# sdist
|
||||
if 'bdist_wheel' not in sys.argv:
|
||||
|
||||
if 'win32' in str(sys.platform).lower():
|
||||
# Terminal colors for Windows
|
||||
install_requires.extend(install_requires_win_only)
|
||||
|
||||
|
||||
# bdist_wheel
|
||||
extras_require = {
|
||||
'dev': dev_require,
|
||||
'test': tests_require,
|
||||
# https://wheel.readthedocs.io/en/latest/#defining-conditional-dependencies
|
||||
':sys_platform == "win32"': install_requires_win_only,
|
||||
}
|
||||
|
||||
|
||||
def long_description():
|
||||
with open('README.md', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
setup(
|
||||
name='httpie',
|
||||
version=httpie.__version__,
|
||||
description=httpie.__doc__.strip(),
|
||||
long_description=long_description(),
|
||||
long_description_content_type='text/markdown',
|
||||
url='https://httpie.io/',
|
||||
download_url=f'https://github.com/httpie/httpie/archive/{httpie.__version__}.tar.gz',
|
||||
author=httpie.__author__,
|
||||
author_email='jakub@roztocil.co',
|
||||
license=httpie.__licence__,
|
||||
packages=find_packages(include=['httpie', 'httpie.*']),
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'http = httpie.__main__:main',
|
||||
'https = httpie.__main__:main',
|
||||
'httpie = httpie.manager.__main__:main',
|
||||
],
|
||||
},
|
||||
python_requires='>=3.7',
|
||||
extras_require=extras_require,
|
||||
install_requires=install_requires,
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'Environment :: Console',
|
||||
'Intended Audience :: Developers',
|
||||
'Intended Audience :: System Administrators',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'Topic :: Internet :: WWW/HTTP',
|
||||
'Topic :: Software Development',
|
||||
'Topic :: System :: Networking',
|
||||
'Topic :: Terminals',
|
||||
'Topic :: Text Processing',
|
||||
'Topic :: Utilities'
|
||||
],
|
||||
project_urls={
|
||||
'GitHub': 'https://github.com/httpie/httpie',
|
||||
'Twitter': 'https://twitter.com/httpie',
|
||||
'Discord': 'https://httpie.io/discord',
|
||||
'Documentation': 'https://httpie.io/docs',
|
||||
'Online Demo': 'https://httpie.io/run',
|
||||
},
|
||||
data_files=[
|
||||
('share/man/man1', ['extras/man/http.1']),
|
||||
('share/man/man1', ['extras/man/https.1']),
|
||||
('share/man/man1', ['extras/man/httpie.1']),
|
||||
]
|
||||
)
|
||||
setup()
|
||||
|
@ -31,7 +31,7 @@ description: |
|
||||
Links
|
||||
- Documentation: https://httpie.io/docs
|
||||
- Try in browser: https://httpie.io/run
|
||||
- GitHub: https://github.com/httpie/httpie
|
||||
- GitHub: https://github.com/httpie/cli
|
||||
- Twitter: https://twitter.com/httpie
|
||||
- Discord: https://httpie.io/chat
|
||||
license: BSD-3-Clause-LBNL
|
||||
|
@ -1,3 +1,3 @@
|
||||
# HTTPie Test Suite
|
||||
|
||||
Please see [CONTRIBUTING](https://github.com/httpie/httpie/blob/master/CONTRIBUTING.md) for contribution and testing guidelines.
|
||||
Please see [CONTRIBUTING](https://github.com/httpie/cli/blob/master/CONTRIBUTING.md) for contribution and testing guidelines.
|
||||
|
@ -2,15 +2,16 @@ import socket
|
||||
|
||||
import pytest
|
||||
from pytest_httpbin import certs
|
||||
from pytest_httpbin.serve import Server as PyTestHttpBinServer
|
||||
|
||||
from .utils import ( # noqa
|
||||
from .utils import ( # noqa
|
||||
HTTPBIN_WITH_CHUNKED_SUPPORT_DOMAIN,
|
||||
HTTPBIN_WITH_CHUNKED_SUPPORT,
|
||||
REMOTE_HTTPBIN_DOMAIN,
|
||||
IS_PYOPENSSL,
|
||||
mock_env
|
||||
)
|
||||
from .utils.plugins_cli import ( # noqa
|
||||
from .utils.plugins_cli import ( # noqa
|
||||
broken_plugin,
|
||||
dummy_plugin,
|
||||
dummy_plugins,
|
||||
@ -18,7 +19,11 @@ from .utils.plugins_cli import ( # noqa
|
||||
httpie_plugins_success,
|
||||
interface,
|
||||
)
|
||||
from .utils.http_server import http_server, localhost_http_server # noqa
|
||||
from .utils.http_server import http_server, localhost_http_server # noqa
|
||||
|
||||
|
||||
# Patch to support `url = str(server)` in addition to `url = server + '/foo'`.
|
||||
PyTestHttpBinServer.__str__ = lambda self: self.url
|
||||
|
||||
|
||||
@pytest.fixture(scope='function', autouse=True)
|
||||
|
@ -42,7 +42,7 @@ def test_bearer_auth(httpbin_both, token):
|
||||
new=lambda self, prompt: 'password')
|
||||
def test_password_prompt(httpbin):
|
||||
r = http('--auth', 'user',
|
||||
'GET', httpbin.url + '/basic-auth/user/password')
|
||||
'GET', httpbin + '/basic-auth/user/password')
|
||||
assert HTTP_OK in r
|
||||
assert r.json == {'authenticated': True, 'user': 'user'}
|
||||
|
||||
@ -71,7 +71,7 @@ def test_credentials_in_url_auth_flag_has_priority(httpbin_both):
|
||||
])
|
||||
def test_only_username_in_url(url):
|
||||
"""
|
||||
https://github.com/httpie/httpie/issues/242
|
||||
https://github.com/httpie/cli/issues/242
|
||||
|
||||
"""
|
||||
args = httpie.cli.definition.parser.parse_args(args=[url], env=MockEnvironment())
|
||||
|
@ -15,18 +15,18 @@ class TestBinaryRequestData:
|
||||
stdin_isatty=False,
|
||||
stdout_isatty=False
|
||||
)
|
||||
r = http('--print=B', 'POST', httpbin.url + '/post', env=env)
|
||||
r = http('--print=B', 'POST', httpbin + '/post', env=env)
|
||||
assert r == BIN_FILE_CONTENT
|
||||
|
||||
def test_binary_file_path(self, httpbin):
|
||||
env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
|
||||
r = http('--print=B', 'POST', httpbin.url + '/post',
|
||||
r = http('--print=B', 'POST', httpbin + '/post',
|
||||
'@' + BIN_FILE_PATH_ARG, env=env)
|
||||
assert r == BIN_FILE_CONTENT
|
||||
|
||||
def test_binary_file_form(self, httpbin):
|
||||
env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
|
||||
r = http('--print=B', '--form', 'POST', httpbin.url + '/post',
|
||||
r = http('--print=B', '--form', 'POST', httpbin + '/post',
|
||||
'test@' + BIN_FILE_PATH_ARG, env=env)
|
||||
assert bytes(BIN_FILE_CONTENT) in bytes(r)
|
||||
|
||||
|
@ -151,17 +151,17 @@ class TestItemParsing:
|
||||
|
||||
class TestQuerystring:
|
||||
def test_query_string_params_in_url(self, httpbin):
|
||||
r = http('--print=Hhb', 'GET', httpbin.url + '/get?a=1&b=2')
|
||||
r = http('--print=Hhb', 'GET', httpbin + '/get?a=1&b=2')
|
||||
path = '/get?a=1&b=2'
|
||||
url = httpbin.url + path
|
||||
url = httpbin + path
|
||||
assert HTTP_OK in r
|
||||
assert f'GET {path} HTTP/1.1' in r
|
||||
assert f'"url": "{url}"' in r
|
||||
|
||||
def test_query_string_params_items(self, httpbin):
|
||||
r = http('--print=Hhb', 'GET', httpbin.url + '/get', 'a==1')
|
||||
r = http('--print=Hhb', 'GET', httpbin + '/get', 'a==1')
|
||||
path = '/get?a=1'
|
||||
url = httpbin.url + path
|
||||
url = httpbin + path
|
||||
assert HTTP_OK in r
|
||||
assert f'GET {path} HTTP/1.1' in r
|
||||
assert f'"url": "{url}"' in r
|
||||
@ -169,9 +169,9 @@ class TestQuerystring:
|
||||
def test_query_string_params_in_url_and_items_with_duplicates(self,
|
||||
httpbin):
|
||||
r = http('--print=Hhb', 'GET',
|
||||
httpbin.url + '/get?a=1&a=1', 'a==1', 'a==1')
|
||||
httpbin + '/get?a=1&a=1', 'a==1', 'a==1')
|
||||
path = '/get?a=1&a=1&a=1&a=1'
|
||||
url = httpbin.url + path
|
||||
url = httpbin + path
|
||||
assert HTTP_OK in r
|
||||
assert f'GET {path} HTTP/1.1' in r
|
||||
assert f'"url": "{url}"' in r
|
||||
@ -320,11 +320,11 @@ class TestArgumentParser:
|
||||
class TestNoOptions:
|
||||
|
||||
def test_valid_no_options(self, httpbin):
|
||||
r = http('--verbose', '--no-verbose', 'GET', httpbin.url + '/get')
|
||||
r = http('--verbose', '--no-verbose', 'GET', httpbin + '/get')
|
||||
assert 'GET /get HTTP/1.1' not in r
|
||||
|
||||
def test_invalid_no_options(self, httpbin):
|
||||
r = http('--no-war', 'GET', httpbin.url + '/get',
|
||||
r = http('--no-war', 'GET', httpbin + '/get',
|
||||
tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.ERROR
|
||||
assert 'unrecognized arguments: --no-war' in r.stderr
|
||||
@ -338,13 +338,13 @@ class TestStdin:
|
||||
stdin=StdinBytesIO(FILE_PATH.read_bytes()),
|
||||
stdin_isatty=False,
|
||||
)
|
||||
r = http('--ignore-stdin', '--verbose', httpbin.url + '/get', env=env)
|
||||
r = http('--ignore-stdin', '--verbose', httpbin + '/get', env=env)
|
||||
assert HTTP_OK in r
|
||||
assert 'GET /get HTTP' in r, "Don't default to POST."
|
||||
assert FILE_CONTENT not in r, "Don't send stdin data."
|
||||
|
||||
def test_ignore_stdin_cannot_prompt_password(self, httpbin):
|
||||
r = http('--ignore-stdin', '--auth=no-password', httpbin.url + '/get',
|
||||
r = http('--ignore-stdin', '--auth=no-password', httpbin + '/get',
|
||||
tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.ERROR
|
||||
assert 'because --ignore-stdin' in r.stderr
|
||||
|
@ -29,14 +29,14 @@ def assert_decompressed_equal(base64_compressed_data, expected_str):
|
||||
|
||||
|
||||
def test_cannot_combine_compress_with_chunked(httpbin):
|
||||
r = http('--compress', '--chunked', httpbin.url + '/get',
|
||||
r = http('--compress', '--chunked', httpbin + '/get',
|
||||
tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.ERROR
|
||||
assert 'cannot combine --compress and --chunked' in r.stderr
|
||||
|
||||
|
||||
def test_cannot_combine_compress_with_multipart(httpbin):
|
||||
r = http('--compress', '--multipart', httpbin.url + '/get',
|
||||
r = http('--compress', '--multipart', httpbin + '/get',
|
||||
tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.ERROR
|
||||
assert 'cannot combine --compress and --multipart' in r.stderr
|
||||
|
@ -17,7 +17,7 @@ def test_default_options(httpbin):
|
||||
env = MockEnvironment()
|
||||
env.config['default_options'] = ['--form']
|
||||
env.config.save()
|
||||
r = http(httpbin.url + '/post', 'foo=bar', env=env)
|
||||
r = http(httpbin + '/post', 'foo=bar', env=env)
|
||||
assert r.json['form'] == {
|
||||
"foo": "bar"
|
||||
}
|
||||
@ -51,7 +51,7 @@ def test_default_options_overwrite(httpbin):
|
||||
env = MockEnvironment()
|
||||
env.config['default_options'] = ['--form']
|
||||
env.config.save()
|
||||
r = http('--json', httpbin.url + '/post', 'foo=bar', env=env)
|
||||
r = http('--json', httpbin + '/post', 'foo=bar', env=env)
|
||||
assert r.json['json'] == {
|
||||
"foo": "bar"
|
||||
}
|
||||
|
@ -2,54 +2,47 @@ import pytest
|
||||
from .utils import http
|
||||
|
||||
|
||||
def _stringify(fixture):
|
||||
return fixture + ''
|
||||
|
||||
|
||||
@pytest.mark.parametrize('instance', [
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
@pytest.mark.parametrize('target_httpbin', [
|
||||
'httpbin',
|
||||
'remote_httpbin',
|
||||
])
|
||||
def test_explicit_user_set_cookie(httpbin, instance):
|
||||
# User set cookies ARE NOT persisted within redirects
|
||||
# when there is no session, even on the same domain.
|
||||
|
||||
def test_explicit_user_set_cookie(httpbin, target_httpbin, request):
|
||||
"""User set cookies ARE NOT persisted within redirects when there is no session, even on the same domain."""
|
||||
target_httpbin = request.getfixturevalue(target_httpbin)
|
||||
r = http(
|
||||
'--follow',
|
||||
httpbin + '/redirect-to',
|
||||
f'url=={_stringify(instance)}/cookies',
|
||||
f'url=={target_httpbin}/cookies',
|
||||
'Cookie:a=b'
|
||||
)
|
||||
assert r.json == {'cookies': {}}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('instance', [
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
@pytest.mark.parametrize('target_httpbin', [
|
||||
'httpbin',
|
||||
'remote_httpbin',
|
||||
])
|
||||
def test_explicit_user_set_cookie_in_session(tmp_path, httpbin, instance):
|
||||
# User set cookies ARE persisted within redirects
|
||||
# when there is A session, even on the same domain.
|
||||
|
||||
def test_explicit_user_set_cookie_in_session(tmp_path, httpbin, target_httpbin, request):
|
||||
"""User set cookies ARE persisted within redirects when there is A session, even on the same domain."""
|
||||
target_httpbin = request.getfixturevalue(target_httpbin)
|
||||
r = http(
|
||||
'--follow',
|
||||
'--session',
|
||||
str(tmp_path / 'session.json'),
|
||||
httpbin + '/redirect-to',
|
||||
f'url=={_stringify(instance)}/cookies',
|
||||
f'url=={target_httpbin}/cookies',
|
||||
'Cookie:a=b'
|
||||
)
|
||||
assert r.json == {'cookies': {'a': 'b'}}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('instance', [
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
@pytest.mark.parametrize('target_httpbin', [
|
||||
'httpbin',
|
||||
'remote_httpbin',
|
||||
])
|
||||
def test_saved_user_set_cookie_in_session(tmp_path, httpbin, instance):
|
||||
# User set cookies ARE persisted within redirects
|
||||
# when there is A session, even on the same domain.
|
||||
|
||||
def test_saved_user_set_cookie_in_session(tmp_path, httpbin, target_httpbin, request):
|
||||
"""User set cookies ARE persisted within redirects when there is A session, even on the same domain."""
|
||||
target_httpbin = request.getfixturevalue(target_httpbin)
|
||||
http(
|
||||
'--follow',
|
||||
'--session',
|
||||
@ -62,32 +55,33 @@ def test_saved_user_set_cookie_in_session(tmp_path, httpbin, instance):
|
||||
'--session',
|
||||
str(tmp_path / 'session.json'),
|
||||
httpbin + '/redirect-to',
|
||||
f'url=={_stringify(instance)}/cookies',
|
||||
f'url=={target_httpbin}/cookies',
|
||||
)
|
||||
assert r.json == {'cookies': {'a': 'b'}}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('instance', [
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
@pytest.mark.parametrize('target_httpbin', [
|
||||
'httpbin',
|
||||
'remote_httpbin',
|
||||
])
|
||||
@pytest.mark.parametrize('session', [True, False])
|
||||
def test_explicit_user_set_headers(httpbin, tmp_path, instance, session):
|
||||
# User set headers ARE persisted within redirects
|
||||
# even on different domains domain with or without
|
||||
# an active session.
|
||||
def test_explicit_user_set_headers(httpbin, tmp_path, target_httpbin, session, request):
|
||||
"""
|
||||
User set headers ARE persisted within redirects even on different domains domain with or without an active session.
|
||||
|
||||
"""
|
||||
target_httpbin = request.getfixturevalue(target_httpbin)
|
||||
session_args = []
|
||||
if session:
|
||||
session_args.extend([
|
||||
'--session',
|
||||
str(tmp_path / 'session.json')
|
||||
])
|
||||
|
||||
r = http(
|
||||
'--follow',
|
||||
*session_args,
|
||||
httpbin + '/redirect-to',
|
||||
f'url=={_stringify(instance)}/get',
|
||||
f'url=={target_httpbin}/get',
|
||||
'X-Custom-Header:value'
|
||||
)
|
||||
assert 'X-Custom-Header' in r.json['headers']
|
||||
@ -95,16 +89,13 @@ def test_explicit_user_set_headers(httpbin, tmp_path, instance, session):
|
||||
|
||||
@pytest.mark.parametrize('session', [True, False])
|
||||
def test_server_set_cookie_on_redirect_same_domain(tmp_path, httpbin, session):
|
||||
# Server set cookies ARE persisted on the same domain
|
||||
# when they are forwarded.
|
||||
|
||||
"""Server set cookies ARE persisted on the same domain when they are forwarded."""
|
||||
session_args = []
|
||||
if session:
|
||||
session_args.extend([
|
||||
'--session',
|
||||
str(tmp_path / 'session.json')
|
||||
])
|
||||
|
||||
r = http(
|
||||
'--follow',
|
||||
*session_args,
|
||||
@ -136,8 +127,7 @@ def test_server_set_cookie_on_redirect_different_domain(tmp_path, http_server, h
|
||||
|
||||
|
||||
def test_saved_session_cookies_on_same_domain(tmp_path, httpbin):
|
||||
# Saved session cookies ARE persisted when making a new
|
||||
# request to the same domain.
|
||||
"""Saved session cookies ARE persisted when making a new request to the same domain."""
|
||||
http(
|
||||
'--session',
|
||||
str(tmp_path / 'session.json'),
|
||||
@ -152,8 +142,7 @@ def test_saved_session_cookies_on_same_domain(tmp_path, httpbin):
|
||||
|
||||
|
||||
def test_saved_session_cookies_on_different_domain(tmp_path, httpbin, remote_httpbin):
|
||||
# Saved session cookies ARE persisted when making a new
|
||||
# request to a different domain.
|
||||
"""Saved session cookies ARE persisted when making a new request to a different domain."""
|
||||
http(
|
||||
'--session',
|
||||
str(tmp_path / 'session.json'),
|
||||
@ -167,45 +156,49 @@ def test_saved_session_cookies_on_different_domain(tmp_path, httpbin, remote_htt
|
||||
assert r.json == {'cookies': {}}
|
||||
|
||||
|
||||
@pytest.mark.parametrize('initial_domain, first_request_domain, second_request_domain, expect_cookies', [
|
||||
@pytest.mark.parametrize(['initial_domain', 'first_request_domain', 'second_request_domain', 'expect_cookies'], [
|
||||
(
|
||||
# Cookies are set by Domain A
|
||||
# Initial domain is Domain A
|
||||
# Redirected domain is Domain A
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
'httpbin',
|
||||
'httpbin',
|
||||
'httpbin',
|
||||
True,
|
||||
),
|
||||
(
|
||||
# Cookies are set by Domain A
|
||||
# Initial domain is Domain B
|
||||
# Redirected domain is Domain B
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
'httpbin',
|
||||
'remote_httpbin',
|
||||
'remote_httpbin',
|
||||
False,
|
||||
),
|
||||
(
|
||||
# Cookies are set by Domain A
|
||||
# Initial domain is Domain A
|
||||
# Redirected domain is Domain B
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
'httpbin',
|
||||
'httpbin',
|
||||
'remote_httpbin',
|
||||
False,
|
||||
),
|
||||
(
|
||||
# Cookies are set by Domain A
|
||||
# Initial domain is Domain B
|
||||
# Redirected domain is Domain A
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
pytest.lazy_fixture('httpbin'),
|
||||
'httpbin',
|
||||
'remote_httpbin',
|
||||
'httpbin',
|
||||
True,
|
||||
),
|
||||
])
|
||||
def test_saved_session_cookies_on_redirect(tmp_path, initial_domain, first_request_domain, second_request_domain, expect_cookies):
|
||||
def test_saved_session_cookies_on_redirect(
|
||||
tmp_path, initial_domain, first_request_domain, second_request_domain, expect_cookies, request):
|
||||
initial_domain = request.getfixturevalue(initial_domain)
|
||||
first_request_domain = request.getfixturevalue(first_request_domain)
|
||||
second_request_domain = request.getfixturevalue(second_request_domain)
|
||||
http(
|
||||
'--session',
|
||||
str(tmp_path / 'session.json'),
|
||||
@ -216,7 +209,7 @@ def test_saved_session_cookies_on_redirect(tmp_path, initial_domain, first_reque
|
||||
str(tmp_path / 'session.json'),
|
||||
'--follow',
|
||||
first_request_domain + '/redirect-to',
|
||||
f'url=={_stringify(second_request_domain)}/cookies'
|
||||
f'url=={second_request_domain}/cookies'
|
||||
)
|
||||
if expect_cookies:
|
||||
expected_data = {'cookies': {'a': 'b'}}
|
||||
|
@ -11,12 +11,12 @@ from .fixtures import FILE_PATH
|
||||
|
||||
def test_default_headers_case_insensitive(httpbin):
|
||||
"""
|
||||
<https://github.com/httpie/httpie/issues/644>
|
||||
<https://github.com/httpie/cli/issues/644>
|
||||
"""
|
||||
r = http(
|
||||
'--debug',
|
||||
'--print=H',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
'CONTENT-TYPE:application/json-patch+json',
|
||||
'a=b',
|
||||
)
|
||||
@ -27,26 +27,26 @@ def test_default_headers_case_insensitive(httpbin):
|
||||
# noinspection PyPep8Naming
|
||||
class TestImplicitHTTPMethod:
|
||||
def test_implicit_GET(self, httpbin):
|
||||
r = http(httpbin.url + '/get')
|
||||
r = http(httpbin + '/get')
|
||||
assert HTTP_OK in r
|
||||
|
||||
def test_implicit_GET_with_headers(self, httpbin):
|
||||
r = http(httpbin.url + '/headers', 'Foo:bar')
|
||||
r = http(httpbin + '/headers', 'Foo:bar')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['headers']['Foo'] == 'bar'
|
||||
|
||||
def test_implicit_POST_json(self, httpbin):
|
||||
r = http(httpbin.url + '/post', 'hello=world')
|
||||
r = http(httpbin + '/post', 'hello=world')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['json'] == {'hello': 'world'}
|
||||
|
||||
def test_implicit_POST_form(self, httpbin):
|
||||
r = http('--form', httpbin.url + '/post', 'foo=bar')
|
||||
r = http('--form', httpbin + '/post', 'foo=bar')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['form'] == {'foo': 'bar'}
|
||||
|
||||
def test_implicit_POST_raw(self, httpbin):
|
||||
r = http('--raw', 'foo bar', httpbin.url + '/post')
|
||||
r = http('--raw', 'foo bar', httpbin + '/post')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['data'] == 'foo bar'
|
||||
|
||||
@ -55,7 +55,7 @@ class TestImplicitHTTPMethod:
|
||||
stdin_isatty=False,
|
||||
stdin=BytesIO(FILE_PATH.read_bytes())
|
||||
)
|
||||
r = http('--form', httpbin.url + '/post', env=env)
|
||||
r = http('--form', httpbin + '/post', env=env)
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
@ -68,42 +68,42 @@ class TestAutoContentTypeAndAcceptHeaders:
|
||||
"""
|
||||
|
||||
def test_GET_no_data_no_auto_headers(self, httpbin):
|
||||
# https://github.com/httpie/httpie/issues/62
|
||||
r = http('GET', httpbin.url + '/headers')
|
||||
# https://github.com/httpie/cli/issues/62
|
||||
r = http('GET', httpbin + '/headers')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['headers']['Accept'] == '*/*'
|
||||
assert 'Content-Type' not in r.json['headers']
|
||||
|
||||
def test_POST_no_data_no_auto_headers(self, httpbin):
|
||||
# JSON headers shouldn't be automatically set for POST with no data.
|
||||
r = http('POST', httpbin.url + '/post')
|
||||
r = http('POST', httpbin + '/post')
|
||||
assert HTTP_OK in r
|
||||
assert '"Accept": "*/*"' in r
|
||||
assert '"Content-Type": "application/json' not in r
|
||||
|
||||
def test_POST_with_data_auto_JSON_headers(self, httpbin):
|
||||
r = http('POST', httpbin.url + '/post', 'a=b')
|
||||
r = http('POST', httpbin + '/post', 'a=b')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['headers']['Accept'] == JSON_ACCEPT
|
||||
assert r.json['headers']['Content-Type'] == 'application/json'
|
||||
|
||||
def test_GET_with_data_auto_JSON_headers(self, httpbin):
|
||||
# JSON headers should automatically be set also for GET with data.
|
||||
r = http('POST', httpbin.url + '/post', 'a=b')
|
||||
r = http('POST', httpbin + '/post', 'a=b')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['headers']['Accept'] == JSON_ACCEPT
|
||||
assert r.json['headers']['Content-Type'] == 'application/json'
|
||||
|
||||
def test_POST_explicit_JSON_JSON_ACCEPT(self, httpbin):
|
||||
r = http('--json', 'POST', httpbin.url + '/post')
|
||||
r = http('--json', 'POST', httpbin + '/post')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['headers']['Accept'] == JSON_ACCEPT
|
||||
# Make sure Content-Type gets set even with no data.
|
||||
# https://github.com/httpie/httpie/issues/137
|
||||
# https://github.com/httpie/cli/issues/137
|
||||
assert 'application/json' in r.json['headers']['Content-Type']
|
||||
|
||||
def test_GET_explicit_JSON_explicit_headers(self, httpbin):
|
||||
r = http('--json', 'GET', httpbin.url + '/headers',
|
||||
r = http('--json', 'GET', httpbin + '/headers',
|
||||
'Accept:application/xml',
|
||||
'Content-Type:application/xml')
|
||||
assert HTTP_OK in r
|
||||
@ -111,22 +111,22 @@ class TestAutoContentTypeAndAcceptHeaders:
|
||||
assert '"Content-Type": "application/xml"' in r
|
||||
|
||||
def test_POST_form_auto_Content_Type(self, httpbin):
|
||||
r = http('--form', 'POST', httpbin.url + '/post')
|
||||
r = http('--form', 'POST', httpbin + '/post')
|
||||
assert HTTP_OK in r
|
||||
assert '"Content-Type": "application/x-www-form-urlencoded' in r
|
||||
|
||||
def test_POST_form_Content_Type_override(self, httpbin):
|
||||
r = http('--form', 'POST', httpbin.url + '/post',
|
||||
r = http('--form', 'POST', httpbin + '/post',
|
||||
'Content-Type:application/xml')
|
||||
assert HTTP_OK in r
|
||||
assert '"Content-Type": "application/xml"' in r
|
||||
|
||||
def test_print_only_body_when_stdout_redirected_by_default(self, httpbin):
|
||||
env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
|
||||
r = http('GET', httpbin.url + '/get', env=env)
|
||||
r = http('GET', httpbin + '/get', env=env)
|
||||
assert 'HTTP/' not in r
|
||||
|
||||
def test_print_overridable_when_stdout_redirected(self, httpbin):
|
||||
env = MockEnvironment(stdin_isatty=True, stdout_isatty=False)
|
||||
r = http('--print=h', 'GET', httpbin.url + '/get', env=env)
|
||||
r = http('--print=h', 'GET', httpbin + '/get', env=env)
|
||||
assert HTTP_OK in r
|
||||
|
@ -255,7 +255,7 @@ class TestDownloads:
|
||||
os.chdir(tmp_dirname)
|
||||
try:
|
||||
assert os.listdir('.') == []
|
||||
http('--download', httpbin.url + '/redirect/1')
|
||||
http('--download', httpbin + '/redirect/1')
|
||||
assert os.listdir('.') == [expected_filename]
|
||||
finally:
|
||||
os.chdir(orig_cwd)
|
||||
|
@ -31,90 +31,90 @@ def test_charset_text_pairs():
|
||||
|
||||
def test_unicode_headers(httpbin):
|
||||
# httpbin doesn't interpret UFT-8 headers
|
||||
r = http(httpbin.url + '/headers', f'Test:{UNICODE}')
|
||||
r = http(httpbin + '/headers', f'Test:{UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
def test_unicode_headers_verbose(httpbin):
|
||||
# httpbin doesn't interpret UTF-8 headers
|
||||
r = http('--verbose', httpbin.url + '/headers', f'Test:{UNICODE}')
|
||||
r = http('--verbose', httpbin + '/headers', f'Test:{UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert UNICODE in r
|
||||
|
||||
|
||||
def test_unicode_raw(httpbin):
|
||||
r = http('--raw', f'test {UNICODE}', 'POST', httpbin.url + '/post')
|
||||
r = http('--raw', f'test {UNICODE}', 'POST', httpbin + '/post')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['data'] == f'test {UNICODE}'
|
||||
|
||||
|
||||
def test_unicode_raw_verbose(httpbin):
|
||||
r = http('--verbose', '--raw', f'test {UNICODE}',
|
||||
'POST', httpbin.url + '/post')
|
||||
'POST', httpbin + '/post')
|
||||
assert HTTP_OK in r
|
||||
assert UNICODE in r
|
||||
|
||||
|
||||
def test_unicode_form_item(httpbin):
|
||||
r = http('--form', 'POST', httpbin.url + '/post', f'test={UNICODE}')
|
||||
r = http('--form', 'POST', httpbin + '/post', f'test={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['form'] == {'test': UNICODE}
|
||||
|
||||
|
||||
def test_unicode_form_item_verbose(httpbin):
|
||||
r = http('--verbose', '--form',
|
||||
'POST', httpbin.url + '/post', f'test={UNICODE}')
|
||||
'POST', httpbin + '/post', f'test={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert UNICODE in r
|
||||
|
||||
|
||||
def test_unicode_json_item(httpbin):
|
||||
r = http('--json', 'POST', httpbin.url + '/post', f'test={UNICODE}')
|
||||
r = http('--json', 'POST', httpbin + '/post', f'test={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['json'] == {'test': UNICODE}
|
||||
|
||||
|
||||
def test_unicode_json_item_verbose(httpbin):
|
||||
r = http('--verbose', '--json',
|
||||
'POST', httpbin.url + '/post', f'test={UNICODE}')
|
||||
'POST', httpbin + '/post', f'test={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert UNICODE in r
|
||||
|
||||
|
||||
def test_unicode_raw_json_item(httpbin):
|
||||
r = http('--json', 'POST', httpbin.url + '/post',
|
||||
r = http('--json', 'POST', httpbin + '/post',
|
||||
f'test:={{ "{UNICODE}" : [ "{UNICODE}" ] }}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['json'] == {'test': {UNICODE: [UNICODE]}}
|
||||
|
||||
|
||||
def test_unicode_raw_json_item_verbose(httpbin):
|
||||
r = http('--json', 'POST', httpbin.url + '/post',
|
||||
r = http('--json', 'POST', httpbin + '/post',
|
||||
f'test:={{ "{UNICODE}" : [ "{UNICODE}" ] }}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['json'] == {'test': {UNICODE: [UNICODE]}}
|
||||
|
||||
|
||||
def test_unicode_url_query_arg_item(httpbin):
|
||||
r = http(httpbin.url + '/get', f'test=={UNICODE}')
|
||||
r = http(httpbin + '/get', f'test=={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['args'] == {'test': UNICODE}, r
|
||||
|
||||
|
||||
def test_unicode_url_query_arg_item_verbose(httpbin):
|
||||
r = http('--verbose', httpbin.url + '/get', f'test=={UNICODE}')
|
||||
r = http('--verbose', httpbin + '/get', f'test=={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert UNICODE in r
|
||||
|
||||
|
||||
def test_unicode_url(httpbin):
|
||||
r = http(f'{httpbin.url}/get?test={UNICODE}')
|
||||
r = http(f'{httpbin}/get?test={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['args'] == {'test': UNICODE}
|
||||
|
||||
|
||||
def test_unicode_url_verbose(httpbin):
|
||||
r = http('--verbose', f'{httpbin.url}/get?test={UNICODE}')
|
||||
r = http('--verbose', f'{httpbin}/get?test={UNICODE}')
|
||||
assert HTTP_OK in r
|
||||
assert r.json['args'] == {'test': UNICODE}
|
||||
|
||||
@ -123,7 +123,7 @@ def test_unicode_basic_auth(httpbin):
|
||||
# it doesn't really authenticate us because httpbin
|
||||
# doesn't interpret the UTF-8-encoded auth
|
||||
http('--verbose', '--auth', f'test:{UNICODE}',
|
||||
f'{httpbin.url}/basic-auth/test/{UNICODE}')
|
||||
f'{httpbin}/basic-auth/test/{UNICODE}')
|
||||
|
||||
|
||||
def test_unicode_digest_auth(httpbin):
|
||||
@ -131,7 +131,7 @@ def test_unicode_digest_auth(httpbin):
|
||||
# doesn't interpret the UTF-8-encoded auth
|
||||
http('--auth-type=digest',
|
||||
'--auth', f'test:{UNICODE}',
|
||||
f'{httpbin.url}/digest-auth/auth/test/{UNICODE}')
|
||||
f'{httpbin}/digest-auth/auth/test/{UNICODE}')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('charset, text', CHARSET_TEXT_PAIRS)
|
||||
|
@ -7,25 +7,25 @@ from .utils import MockEnvironment, http, HTTP_OK
|
||||
def test_keyboard_interrupt_during_arg_parsing_exit_status(httpbin):
|
||||
with mock.patch('httpie.cli.definition.parser.parse_args',
|
||||
side_effect=KeyboardInterrupt()):
|
||||
r = http('GET', httpbin.url + '/get', tolerate_error_exit_status=True)
|
||||
r = http('GET', httpbin + '/get', tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.ERROR_CTRL_C
|
||||
|
||||
|
||||
def test_keyboard_interrupt_in_program_exit_status(httpbin):
|
||||
with mock.patch('httpie.core.program',
|
||||
side_effect=KeyboardInterrupt()):
|
||||
r = http('GET', httpbin.url + '/get', tolerate_error_exit_status=True)
|
||||
r = http('GET', httpbin + '/get', tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.ERROR_CTRL_C
|
||||
|
||||
|
||||
def test_ok_response_exits_0(httpbin):
|
||||
r = http('GET', httpbin.url + '/get')
|
||||
r = http('GET', httpbin + '/get')
|
||||
assert HTTP_OK in r
|
||||
assert r.exit_status == ExitStatus.SUCCESS
|
||||
|
||||
|
||||
def test_error_response_exits_0_without_check_status(httpbin):
|
||||
r = http('GET', httpbin.url + '/status/500')
|
||||
r = http('GET', httpbin + '/status/500')
|
||||
assert '500 INTERNAL SERVER ERROR' in r
|
||||
assert r.exit_status == ExitStatus.SUCCESS
|
||||
assert not r.stderr
|
||||
@ -33,7 +33,7 @@ def test_error_response_exits_0_without_check_status(httpbin):
|
||||
|
||||
def test_timeout_exit_status(httpbin):
|
||||
|
||||
r = http('--timeout=0.01', 'GET', httpbin.url + '/delay/0.5',
|
||||
r = http('--timeout=0.01', 'GET', httpbin + '/delay/0.5',
|
||||
tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.ERROR_TIMEOUT
|
||||
|
||||
@ -42,7 +42,7 @@ def test_3xx_check_status_exits_3_and_stderr_when_stdout_redirected(
|
||||
httpbin):
|
||||
env = MockEnvironment(stdout_isatty=False)
|
||||
r = http('--check-status', '--headers',
|
||||
'GET', httpbin.url + '/status/301',
|
||||
'GET', httpbin + '/status/301',
|
||||
env=env, tolerate_error_exit_status=True)
|
||||
assert '301 MOVED PERMANENTLY' in r
|
||||
assert r.exit_status == ExitStatus.ERROR_HTTP_3XX
|
||||
@ -51,7 +51,7 @@ def test_3xx_check_status_exits_3_and_stderr_when_stdout_redirected(
|
||||
|
||||
def test_3xx_check_status_redirects_allowed_exits_0(httpbin):
|
||||
r = http('--check-status', '--follow',
|
||||
'GET', httpbin.url + '/status/301',
|
||||
'GET', httpbin + '/status/301',
|
||||
tolerate_error_exit_status=True)
|
||||
# The redirect will be followed so 200 is expected.
|
||||
assert HTTP_OK in r
|
||||
@ -59,7 +59,7 @@ def test_3xx_check_status_redirects_allowed_exits_0(httpbin):
|
||||
|
||||
|
||||
def test_4xx_check_status_exits_4(httpbin):
|
||||
r = http('--check-status', 'GET', httpbin.url + '/status/401',
|
||||
r = http('--check-status', 'GET', httpbin + '/status/401',
|
||||
tolerate_error_exit_status=True)
|
||||
assert '401 UNAUTHORIZED' in r
|
||||
assert r.exit_status == ExitStatus.ERROR_HTTP_4XX
|
||||
@ -68,7 +68,7 @@ def test_4xx_check_status_exits_4(httpbin):
|
||||
|
||||
|
||||
def test_5xx_check_status_exits_5(httpbin):
|
||||
r = http('--check-status', 'GET', httpbin.url + '/status/500',
|
||||
r = http('--check-status', 'GET', httpbin + '/status/500',
|
||||
tolerate_error_exit_status=True)
|
||||
assert '500 INTERNAL SERVER ERROR' in r
|
||||
assert r.exit_status == ExitStatus.ERROR_HTTP_5XX
|
||||
|
@ -36,7 +36,7 @@ def test_debug():
|
||||
def test_help():
|
||||
r = http('--help', tolerate_error_exit_status=True)
|
||||
assert r.exit_status == ExitStatus.SUCCESS
|
||||
assert 'https://github.com/httpie/httpie/issues' in r
|
||||
assert 'https://github.com/httpie/cli/issues' in r
|
||||
|
||||
|
||||
def test_version():
|
||||
@ -124,7 +124,7 @@ def test_POST_file(httpbin_both):
|
||||
|
||||
def test_form_POST_file_redirected_stdin(httpbin):
|
||||
"""
|
||||
<https://github.com/httpie/httpie/issues/840>
|
||||
<https://github.com/httpie/cli/issues/840>
|
||||
|
||||
"""
|
||||
with open(FILE_PATH, encoding=UTF8):
|
||||
@ -196,6 +196,14 @@ def test_unset_host_header(httpbin_both):
|
||||
assert 'Host' not in r.json['headers'] # default Host unset
|
||||
|
||||
|
||||
def test_unset_useragent_header(httpbin_both):
|
||||
r = http('GET', httpbin_both + '/headers')
|
||||
assert 'User-Agent' in r.json['headers'] # default User-Agent present
|
||||
|
||||
r = http('GET', httpbin_both + '/headers', 'User-Agent:')
|
||||
assert 'User-Agent' not in r.json['headers'] # default User-Agent unset
|
||||
|
||||
|
||||
def test_headers_empty_value(httpbin_both):
|
||||
r = http('GET', httpbin_both + '/headers')
|
||||
assert r.json['headers']['Accept'] # default Accept has value
|
||||
|
@ -54,7 +54,7 @@ class TestQuietFlag:
|
||||
stdout_isatty=True,
|
||||
devnull=io.BytesIO()
|
||||
)
|
||||
r = http(*quiet_flags, 'GET', httpbin.url + '/get', env=env)
|
||||
r = http(*quiet_flags, 'GET', httpbin + '/get', env=env)
|
||||
assert env.stdout is env.devnull
|
||||
assert env.stderr is env.devnull
|
||||
assert HTTP_OK in r.devnull
|
||||
@ -134,7 +134,7 @@ class TestQuietFlag:
|
||||
)
|
||||
r = http(
|
||||
*quiet_flags, '--auth', 'user', 'GET',
|
||||
httpbin.url + '/basic-auth/user/password',
|
||||
httpbin + '/basic-auth/user/password',
|
||||
env=env
|
||||
)
|
||||
assert env.stdout is env.devnull
|
||||
@ -147,7 +147,7 @@ class TestQuietFlag:
|
||||
@pytest.mark.parametrize('output_options', ['-h', '-b', '-v', '-p=hH'])
|
||||
def test_quiet_with_explicit_output_options(self, httpbin, quiet_flags, output_options):
|
||||
env = MockEnvironment(stdin_isatty=True, stdout_isatty=True)
|
||||
r = http(*quiet_flags, output_options, httpbin.url + '/get', env=env)
|
||||
r = http(*quiet_flags, output_options, httpbin + '/get', env=env)
|
||||
assert env.stdout is env.devnull
|
||||
assert env.stderr is env.devnull
|
||||
assert r == ''
|
||||
@ -188,26 +188,26 @@ class TestQuietFlag:
|
||||
class TestVerboseFlag:
|
||||
def test_verbose(self, httpbin):
|
||||
r = http('--verbose',
|
||||
'GET', httpbin.url + '/get', 'test-header:__test__')
|
||||
'GET', httpbin + '/get', 'test-header:__test__')
|
||||
assert HTTP_OK in r
|
||||
assert r.count('__test__') == 2
|
||||
|
||||
def test_verbose_raw(self, httpbin):
|
||||
r = http('--verbose', '--raw', 'foo bar',
|
||||
'POST', httpbin.url + '/post')
|
||||
'POST', httpbin + '/post')
|
||||
assert HTTP_OK in r
|
||||
assert 'foo bar' in r
|
||||
|
||||
def test_verbose_form(self, httpbin):
|
||||
# https://github.com/httpie/httpie/issues/53
|
||||
r = http('--verbose', '--form', 'POST', httpbin.url + '/post',
|
||||
# https://github.com/httpie/cli/issues/53
|
||||
r = http('--verbose', '--form', 'POST', httpbin + '/post',
|
||||
'A=B', 'C=D')
|
||||
assert HTTP_OK in r
|
||||
assert 'A=B&C=D' in r
|
||||
|
||||
def test_verbose_json(self, httpbin):
|
||||
r = http('--verbose',
|
||||
'POST', httpbin.url + '/post', 'foo=bar', 'baz=bar')
|
||||
'POST', httpbin + '/post', 'foo=bar', 'baz=bar')
|
||||
assert HTTP_OK in r
|
||||
assert '"baz": "bar"' in r
|
||||
|
||||
@ -290,20 +290,20 @@ class TestPrettyOptions:
|
||||
|
||||
def test_pretty_enabled_by_default(self, httpbin):
|
||||
env = MockEnvironment(colors=256)
|
||||
r = http('GET', httpbin.url + '/get', env=env)
|
||||
r = http('GET', httpbin + '/get', env=env)
|
||||
assert COLOR in r
|
||||
|
||||
def test_pretty_enabled_by_default_unless_stdout_redirected(self, httpbin):
|
||||
r = http('GET', httpbin.url + '/get')
|
||||
r = http('GET', httpbin + '/get')
|
||||
assert COLOR not in r
|
||||
|
||||
def test_force_pretty(self, httpbin):
|
||||
env = MockEnvironment(stdout_isatty=False, colors=256)
|
||||
r = http('--pretty=all', 'GET', httpbin.url + '/get', env=env)
|
||||
r = http('--pretty=all', 'GET', httpbin + '/get', env=env)
|
||||
assert COLOR in r
|
||||
|
||||
def test_force_ugly(self, httpbin):
|
||||
r = http('--pretty=none', 'GET', httpbin.url + '/get')
|
||||
r = http('--pretty=none', 'GET', httpbin + '/get')
|
||||
assert COLOR not in r
|
||||
|
||||
def test_subtype_based_pygments_lexer_match(self, httpbin):
|
||||
@ -312,14 +312,14 @@ class TestPrettyOptions:
|
||||
|
||||
"""
|
||||
env = MockEnvironment(colors=256)
|
||||
r = http('--print=B', '--pretty=all', httpbin.url + '/post',
|
||||
r = http('--print=B', '--pretty=all', httpbin + '/post',
|
||||
'Content-Type:text/foo+json', 'a=b', env=env)
|
||||
assert COLOR in r
|
||||
|
||||
def test_colors_option(self, httpbin):
|
||||
env = MockEnvironment(colors=256)
|
||||
r = http('--print=B', '--pretty=colors',
|
||||
'GET', httpbin.url + '/get', 'a=b',
|
||||
'GET', httpbin + '/get', 'a=b',
|
||||
env=env)
|
||||
# Tests that the JSON data isn't formatted.
|
||||
assert not r.strip().count('\n')
|
||||
@ -328,7 +328,7 @@ class TestPrettyOptions:
|
||||
def test_format_option(self, httpbin):
|
||||
env = MockEnvironment(colors=256)
|
||||
r = http('--print=B', '--pretty=format',
|
||||
'GET', httpbin.url + '/get', 'a=b',
|
||||
'GET', httpbin + '/get', 'a=b',
|
||||
env=env)
|
||||
# Tests that the JSON data is formatted.
|
||||
assert r.strip().count('\n') == 2
|
||||
@ -355,25 +355,25 @@ class TestLineEndings:
|
||||
return body
|
||||
|
||||
def test_CRLF_headers_only(self, httpbin):
|
||||
r = http('--headers', 'GET', httpbin.url + '/get')
|
||||
r = http('--headers', 'GET', httpbin + '/get')
|
||||
body = self._validate_crlf(r)
|
||||
assert not body, f'Garbage after headers: {r!r}'
|
||||
|
||||
def test_CRLF_ugly_response(self, httpbin):
|
||||
r = http('--pretty=none', 'GET', httpbin.url + '/get')
|
||||
r = http('--pretty=none', 'GET', httpbin + '/get')
|
||||
self._validate_crlf(r)
|
||||
|
||||
def test_CRLF_formatted_response(self, httpbin):
|
||||
r = http('--pretty=format', 'GET', httpbin.url + '/get')
|
||||
r = http('--pretty=format', 'GET', httpbin + '/get')
|
||||
assert r.exit_status == ExitStatus.SUCCESS
|
||||
self._validate_crlf(r)
|
||||
|
||||
def test_CRLF_ugly_request(self, httpbin):
|
||||
r = http('--pretty=none', '--print=HB', 'GET', httpbin.url + '/get')
|
||||
r = http('--pretty=none', '--print=HB', 'GET', httpbin + '/get')
|
||||
self._validate_crlf(r)
|
||||
|
||||
def test_CRLF_formatted_request(self, httpbin):
|
||||
r = http('--pretty=format', '--print=HB', 'GET', httpbin.url + '/get')
|
||||
r = http('--pretty=format', '--print=HB', 'GET', httpbin + '/get')
|
||||
self._validate_crlf(r)
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@ REDIRECTS_WITH_METHOD_BODY_PRESERVED = [307, 308]
|
||||
|
||||
|
||||
def test_follow_all_redirects_shown(httpbin):
|
||||
r = http('--follow', '--all', httpbin.url + '/redirect/2')
|
||||
r = http('--follow', '--all', httpbin + '/redirect/2')
|
||||
assert r.count('HTTP/1.1') == 3
|
||||
assert r.count('HTTP/1.1 302 FOUND', 2)
|
||||
assert HTTP_OK in r
|
||||
@ -21,14 +21,14 @@ def test_follow_all_redirects_shown(httpbin):
|
||||
|
||||
@pytest.mark.parametrize('follow_flag', ['--follow', '-F'])
|
||||
def test_follow_without_all_redirects_hidden(httpbin, follow_flag):
|
||||
r = http(follow_flag, httpbin.url + '/redirect/2')
|
||||
r = http(follow_flag, httpbin + '/redirect/2')
|
||||
assert r.count('HTTP/1.1') == 1
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
@pytest.mark.xfail(True, reason="https://github.com/httpie/httpie/issues/1082")
|
||||
@pytest.mark.xfail(True, reason="https://github.com/httpie/cli/issues/1082")
|
||||
def test_follow_output_options_used_for_redirects(httpbin):
|
||||
r = http('--follow', '--print=H', httpbin.url + '/redirect/2')
|
||||
r = http('--follow', '--print=H', httpbin + '/redirect/2')
|
||||
assert r.count('GET /') == 1
|
||||
assert HTTP_OK not in r
|
||||
|
||||
@ -38,7 +38,7 @@ def test_follow_all_output_options_used_for_redirects(httpbin):
|
||||
'--follow',
|
||||
'--all',
|
||||
'--print=H',
|
||||
httpbin.url + '/redirect/2')
|
||||
httpbin + '/redirect/2')
|
||||
assert r.count('GET /') == 3
|
||||
assert HTTP_OK not in r
|
||||
|
||||
@ -50,7 +50,7 @@ def test_follow_all_output_options_used_for_redirects(httpbin):
|
||||
# '--all',
|
||||
# '--print=h',
|
||||
# '--history-print=H',
|
||||
# httpbin.url + '/redirect/2')
|
||||
# httpbin + '/redirect/2')
|
||||
# assert r.count('GET /') == 2
|
||||
# assert 'HTTP/1.1 302 FOUND' not in r
|
||||
# assert HTTP_OK in r
|
||||
@ -61,7 +61,7 @@ def test_max_redirects(httpbin):
|
||||
r = http(
|
||||
'--max-redirects=1',
|
||||
'--follow',
|
||||
httpbin.url + '/redirect/3',
|
||||
httpbin + '/redirect/3',
|
||||
tolerate_error_exit_status=True,
|
||||
)
|
||||
assert r.exit_status == ExitStatus.ERROR_TOO_MANY_REDIRECTS
|
||||
@ -72,11 +72,11 @@ def test_max_redirects(httpbin):
|
||||
def test_follow_redirect_with_repost(httpbin, status_code):
|
||||
r = http(
|
||||
'--follow',
|
||||
httpbin.url + '/redirect-to',
|
||||
httpbin + '/redirect-to',
|
||||
'A:A',
|
||||
'A:B',
|
||||
'B:B',
|
||||
f'url=={httpbin.url}/post',
|
||||
f'url=={httpbin}/post',
|
||||
f'status_code=={status_code}',
|
||||
'@' + FILE_PATH_ARG,
|
||||
)
|
||||
@ -92,11 +92,11 @@ def test_verbose_follow_redirect_with_repost(httpbin, status_code):
|
||||
r = http(
|
||||
'--follow',
|
||||
'--verbose',
|
||||
httpbin.url + '/redirect-to',
|
||||
httpbin + '/redirect-to',
|
||||
'A:A',
|
||||
'A:B',
|
||||
'B:B',
|
||||
f'url=={httpbin.url}/post',
|
||||
f'url=={httpbin}/post',
|
||||
f'status_code=={status_code}',
|
||||
'@' + FILE_PATH_ARG,
|
||||
)
|
||||
|
@ -8,11 +8,11 @@ from .utils import HTTP_OK, MockEnvironment, http
|
||||
|
||||
def test_Host_header_overwrite(httpbin):
|
||||
"""
|
||||
https://github.com/httpie/httpie/issues/235
|
||||
https://github.com/httpie/cli/issues/235
|
||||
|
||||
"""
|
||||
host = 'pie.dev'
|
||||
url = httpbin.url + '/get'
|
||||
url = httpbin + '/get'
|
||||
r = http('--print=hH', url, f'host:{host}')
|
||||
assert HTTP_OK in r
|
||||
assert r.lower().count('host:') == 1
|
||||
@ -22,7 +22,7 @@ def test_Host_header_overwrite(httpbin):
|
||||
@pytest.mark.skipif(is_windows, reason='Unix-only')
|
||||
def test_output_devnull(httpbin):
|
||||
"""
|
||||
https://github.com/httpie/httpie/issues/252
|
||||
https://github.com/httpie/cli/issues/252
|
||||
|
||||
"""
|
||||
http('--output=/dev/null', httpbin + '/get')
|
||||
@ -31,11 +31,11 @@ def test_output_devnull(httpbin):
|
||||
def test_verbose_redirected_stdout_separator(httpbin):
|
||||
"""
|
||||
|
||||
<https://github.com/httpie/httpie/issues/1006>
|
||||
<https://github.com/httpie/cli/issues/1006>
|
||||
"""
|
||||
r = http(
|
||||
'-v',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
'a=b',
|
||||
env=MockEnvironment(stdout_isatty=False),
|
||||
)
|
||||
|
@ -82,7 +82,7 @@ class TestSessionFlow(SessionTestBase):
|
||||
'--session=test',
|
||||
'--auth=username:password',
|
||||
'GET',
|
||||
httpbin.url + '/cookies/set?hello=world',
|
||||
httpbin + '/cookies/set?hello=world',
|
||||
'Hello:World',
|
||||
env=self.env()
|
||||
)
|
||||
@ -92,7 +92,7 @@ class TestSessionFlow(SessionTestBase):
|
||||
self.start_session(httpbin)
|
||||
# Verify that the session created in setup_method() has been used.
|
||||
r2 = http('--session=test',
|
||||
'GET', httpbin.url + '/get', env=self.env())
|
||||
'GET', httpbin + '/get', env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
assert r2.json['headers']['Hello'] == 'World'
|
||||
assert r2.json['headers']['Cookie'] == 'hello=world'
|
||||
@ -101,19 +101,19 @@ class TestSessionFlow(SessionTestBase):
|
||||
def test_session_update(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
# Get a response to a request from the original session.
|
||||
r2 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r2 = http('--session=test', 'GET', httpbin + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
|
||||
# Make a request modifying the session data.
|
||||
r3 = http('--follow', '--session=test', '--auth=username:password2',
|
||||
'GET', httpbin.url + '/cookies/set?hello=world2',
|
||||
'GET', httpbin + '/cookies/set?hello=world2',
|
||||
'Hello:World2',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r3
|
||||
|
||||
# Get a response to a request from the updated session.
|
||||
r4 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r4 = http('--session=test', 'GET', httpbin + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r4
|
||||
assert r4.json['headers']['Hello'] == 'World2'
|
||||
@ -124,7 +124,7 @@ class TestSessionFlow(SessionTestBase):
|
||||
def test_session_read_only(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
# Get a response from the original session.
|
||||
r2 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r2 = http('--session=test', 'GET', httpbin + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
|
||||
@ -132,12 +132,12 @@ class TestSessionFlow(SessionTestBase):
|
||||
# with --session-read-only.
|
||||
r3 = http('--follow', '--session-read-only=test',
|
||||
'--auth=username:password2', 'GET',
|
||||
httpbin.url + '/cookies/set?hello=world2', 'Hello:World2',
|
||||
httpbin + '/cookies/set?hello=world2', 'Hello:World2',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r3
|
||||
|
||||
# Get a response from the updated session.
|
||||
r4 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r4 = http('--session=test', 'GET', httpbin + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r4
|
||||
|
||||
@ -151,17 +151,17 @@ class TestSessionFlow(SessionTestBase):
|
||||
def test_session_overwrite_header(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
|
||||
r2 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r2 = http('--session=test', 'GET', httpbin + '/get',
|
||||
'Hello:World2', env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
assert r2.json['headers']['Hello'] == 'World2'
|
||||
|
||||
r3 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r3 = http('--session=test', 'GET', httpbin + '/get',
|
||||
'Hello:World2', 'Hello:World3', env=self.env())
|
||||
assert HTTP_OK in r3
|
||||
assert r3.json['headers']['Hello'] == 'World2,World3'
|
||||
|
||||
r3 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r3 = http('--session=test', 'GET', httpbin + '/get',
|
||||
'Hello:', 'Hello:World3', env=self.env())
|
||||
assert HTTP_OK in r3
|
||||
assert 'Hello' not in r3.json['headers']['Hello']
|
||||
@ -172,12 +172,12 @@ class TestSession(SessionTestBase):
|
||||
|
||||
def test_session_ignored_header_prefixes(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
r1 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r1 = http('--session=test', 'GET', httpbin + '/get',
|
||||
'Content-Type: text/plain',
|
||||
'If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r1
|
||||
r2 = http('--session=test', 'GET', httpbin.url + '/get',
|
||||
r2 = http('--session=test', 'GET', httpbin + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
assert 'Content-Type' not in r2.json['headers']
|
||||
@ -185,25 +185,25 @@ class TestSession(SessionTestBase):
|
||||
|
||||
def test_session_with_upload(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
r = http('--session=test', '--form', '--verbose', 'POST', httpbin.url + '/post',
|
||||
r = http('--session=test', '--form', '--verbose', 'POST', httpbin + '/post',
|
||||
f'test-file@{FILE_PATH_ARG}', 'foo=bar', env=self.env())
|
||||
assert HTTP_OK in r
|
||||
|
||||
def test_session_by_path(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
session_path = self.config_dir / 'session-by-path.json'
|
||||
r1 = http('--session', str(session_path), 'GET', httpbin.url + '/get',
|
||||
r1 = http('--session', str(session_path), 'GET', httpbin + '/get',
|
||||
'Foo:Bar', env=self.env())
|
||||
assert HTTP_OK in r1
|
||||
|
||||
r2 = http('--session', str(session_path), 'GET', httpbin.url + '/get',
|
||||
r2 = http('--session', str(session_path), 'GET', httpbin + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
assert r2.json['headers']['Foo'] == 'Bar'
|
||||
|
||||
def test_session_with_cookie_followed_by_another_header(self, httpbin):
|
||||
"""
|
||||
Make sure headers don’t get mutated — <https://github.com/httpie/httpie/issues/1126>
|
||||
Make sure headers don’t get mutated — <https://github.com/httpie/cli/issues/1126>
|
||||
"""
|
||||
self.start_session(httpbin)
|
||||
session_data = {
|
||||
@ -214,7 +214,7 @@ class TestSession(SessionTestBase):
|
||||
}
|
||||
session_path = self.config_dir / 'session-data.json'
|
||||
session_path.write_text(json.dumps(session_data))
|
||||
r = http('--session', str(session_path), 'GET', httpbin.url + '/get',
|
||||
r = http('--session', str(session_path), 'GET', httpbin + '/get',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r
|
||||
assert 'Zzz' in r
|
||||
@ -223,12 +223,12 @@ class TestSession(SessionTestBase):
|
||||
self.start_session(httpbin)
|
||||
|
||||
r1 = http('--session=test', f'--auth=test:{UNICODE}',
|
||||
'GET', httpbin.url + '/get', f'Test:{UNICODE}',
|
||||
'GET', httpbin + '/get', f'Test:{UNICODE}',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r1
|
||||
|
||||
r2 = http('--session=test', '--verbose', 'GET',
|
||||
httpbin.url + '/get', env=self.env())
|
||||
httpbin + '/get', env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
|
||||
# FIXME: Authorization *sometimes* is not present
|
||||
@ -239,25 +239,25 @@ class TestSession(SessionTestBase):
|
||||
|
||||
def test_session_default_header_value_overwritten(self, httpbin):
|
||||
self.start_session(httpbin)
|
||||
# https://github.com/httpie/httpie/issues/180
|
||||
# https://github.com/httpie/cli/issues/180
|
||||
r1 = http('--session=test',
|
||||
httpbin.url + '/headers', 'User-Agent:custom',
|
||||
httpbin + '/headers', 'User-Agent:custom',
|
||||
env=self.env())
|
||||
assert HTTP_OK in r1
|
||||
assert r1.json['headers']['User-Agent'] == 'custom'
|
||||
|
||||
r2 = http('--session=test', httpbin.url + '/headers', env=self.env())
|
||||
r2 = http('--session=test', httpbin + '/headers', env=self.env())
|
||||
assert HTTP_OK in r2
|
||||
assert r2.json['headers']['User-Agent'] == 'custom'
|
||||
|
||||
def test_download_in_session(self, tmp_path, httpbin):
|
||||
# https://github.com/httpie/httpie/issues/412
|
||||
# https://github.com/httpie/cli/issues/412
|
||||
self.start_session(httpbin)
|
||||
cwd = os.getcwd()
|
||||
os.chdir(tmp_path)
|
||||
try:
|
||||
http('--session=test', '--download',
|
||||
httpbin.url + '/get', env=self.env())
|
||||
httpbin + '/get', env=self.env())
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
@ -335,7 +335,7 @@ class TestSession(SessionTestBase):
|
||||
assert HTTP_OK in r1
|
||||
assert HTTP_OK in r2
|
||||
|
||||
# additional test for issue: https://github.com/httpie/httpie/issues/1098
|
||||
# additional test for issue: https://github.com/httpie/cli/issues/1098
|
||||
with open(session_path) as session_file:
|
||||
session_file_lines = ''.join(session_file.readlines())
|
||||
assert "\"type\": \"test-prompted\"" in session_file_lines
|
||||
@ -386,7 +386,7 @@ class TestExpiredCookies(CookieTestBase):
|
||||
r = http(
|
||||
'--session', str(self.session_path),
|
||||
'--print=H',
|
||||
httpbin.url + '/cookies/delete?cookie2',
|
||||
httpbin + '/cookies/delete?cookie2',
|
||||
)
|
||||
assert 'Cookie: cookie1=foo; cookie2=foo' in r
|
||||
|
||||
@ -427,7 +427,7 @@ class TestExpiredCookies(CookieTestBase):
|
||||
),
|
||||
(
|
||||
# Checks we gracefully ignore expires date in invalid format.
|
||||
# <https://github.com/httpie/httpie/issues/963>
|
||||
# <https://github.com/httpie/cli/issues/963>
|
||||
'pfg=; Expires=Sat, 19-Sep-2020 06:58:14 GMT+0000; Max-Age=0; path=/; domain=.tumblr.com; secure; HttpOnly',
|
||||
None,
|
||||
[]
|
||||
@ -484,7 +484,7 @@ class TestCookieStorage(CookieTestBase):
|
||||
r = http(
|
||||
'--session', str(self.session_path),
|
||||
'--print=H',
|
||||
httpbin.url,
|
||||
httpbin + '/get',
|
||||
'Cookie:' + specified_cookie_header,
|
||||
)
|
||||
parsed_request_headers = { # noqa
|
||||
@ -537,7 +537,7 @@ class TestCookieStorage(CookieTestBase):
|
||||
"""
|
||||
http(
|
||||
'--session', str(self.session_path),
|
||||
httpbin.url + set_cookie,
|
||||
httpbin + set_cookie,
|
||||
'Cookie:' + cli_cookie,
|
||||
)
|
||||
updated_session = json.loads(self.session_path.read_text(encoding=UTF8))
|
||||
@ -821,16 +821,17 @@ def test_session_multiple_headers_with_same_name(basic_session, httpbin):
|
||||
'server, expected_cookies',
|
||||
[
|
||||
(
|
||||
pytest.lazy_fixture('localhost_http_server'),
|
||||
'localhost_http_server',
|
||||
{'secure_cookie': 'foo', 'insecure_cookie': 'bar'}
|
||||
),
|
||||
(
|
||||
pytest.lazy_fixture('remote_httpbin'),
|
||||
'remote_httpbin',
|
||||
{'insecure_cookie': 'bar'}
|
||||
)
|
||||
]
|
||||
)
|
||||
def test_secure_cookies_on_localhost(mock_env, tmp_path, server, expected_cookies):
|
||||
def test_secure_cookies_on_localhost(mock_env, tmp_path, server, expected_cookies, request):
|
||||
server = request.getfixturevalue(server)
|
||||
session_path = tmp_path / 'session.json'
|
||||
http(
|
||||
'--session', str(session_path),
|
||||
|
@ -15,7 +15,7 @@ from .utils import HTTP_OK, TESTS_ROOT, IS_PYOPENSSL, http
|
||||
|
||||
try:
|
||||
# Handle OpenSSL errors, if installed.
|
||||
# See <https://github.com/httpie/httpie/issues/729>
|
||||
# See <https://github.com/httpie/cli/issues/729>
|
||||
# noinspection PyUnresolvedReferences
|
||||
import OpenSSL.SSL
|
||||
ssl_errors = (
|
||||
|
@ -46,7 +46,7 @@ def test_pretty_redirected_stream(httpbin):
|
||||
stdout_isatty=False,
|
||||
)
|
||||
r = http('--verbose', '--pretty=all', '--stream', 'GET',
|
||||
httpbin.url + '/get', env=env)
|
||||
httpbin + '/get', env=env)
|
||||
assert BINARY_SUPPRESSED_NOTICE.decode() in r
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ def test_pretty_stream_ensure_full_stream_is_retrieved(httpbin):
|
||||
stdout_isatty=False,
|
||||
)
|
||||
r = http('--pretty=format', '--stream', 'GET',
|
||||
httpbin.url + '/stream/3', env=env)
|
||||
httpbin + '/stream/3', env=env)
|
||||
assert r.count('/stream/3') == 3
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ def test_encoded_stream(httpbin):
|
||||
stdin_isatty=False,
|
||||
)
|
||||
r = http('--pretty=none', '--stream', '--verbose', 'GET',
|
||||
httpbin.url + '/get', env=env)
|
||||
httpbin + '/get', env=env)
|
||||
assert BINARY_SUPPRESSED_NOTICE.decode() in r
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ def test_redirected_stream(httpbin):
|
||||
stdin=StdinBytesIO(BIN_FILE_PATH.read_bytes()),
|
||||
)
|
||||
r = http('--pretty=none', '--stream', '--verbose', 'GET',
|
||||
httpbin.url + '/get', env=env)
|
||||
httpbin + '/get', env=env)
|
||||
assert BIN_FILE_CONTENT in r
|
||||
|
||||
|
||||
|
@ -132,10 +132,10 @@ def test_check_updates_first_invocation(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'should_issue_warning, build_channel',
|
||||
['should_issue_warning', 'build_channel'],
|
||||
[
|
||||
(False, pytest.lazy_fixture('lower_build_channel')),
|
||||
(True, pytest.lazy_fixture('higher_build_channel')),
|
||||
(False, 'lower_build_channel'),
|
||||
(True, 'higher_build_channel'),
|
||||
],
|
||||
)
|
||||
def test_check_updates_first_time_after_data_fetch(
|
||||
@ -145,7 +145,9 @@ def test_check_updates_first_time_after_data_fetch(
|
||||
static_fetch_data,
|
||||
should_issue_warning,
|
||||
build_channel,
|
||||
request,
|
||||
):
|
||||
request.getfixturevalue(build_channel)
|
||||
http('fetch_updates', '--daemon', env=with_warnings)
|
||||
r = http(httpbin + '/get', env=with_warnings)
|
||||
|
||||
@ -176,14 +178,15 @@ def test_cli_check_updates(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"build_channel", [
|
||||
pytest.lazy_fixture("lower_build_channel"),
|
||||
pytest.lazy_fixture("unknown_build_channel")
|
||||
'build_channel', [
|
||||
'lower_build_channel',
|
||||
'unknown_build_channel',
|
||||
]
|
||||
)
|
||||
def test_cli_check_updates_not_shown(
|
||||
static_fetch_data, build_channel
|
||||
static_fetch_data, build_channel, request
|
||||
):
|
||||
request.getfixturevalue(build_channel)
|
||||
r = httpie('cli', 'check-updates')
|
||||
assert r.exit_status == ExitStatus.SUCCESS
|
||||
assert not check_update_warnings(r)
|
||||
|
@ -192,10 +192,10 @@ class TestMultipartFormDataFileUpload:
|
||||
def test_non_existent_file_raises_parse_error(self, httpbin):
|
||||
with pytest.raises(ParseError):
|
||||
http('--form',
|
||||
'POST', httpbin.url + '/post', 'foo@/__does_not_exist__')
|
||||
'POST', httpbin + '/post', 'foo@/__does_not_exist__')
|
||||
|
||||
def test_upload_ok(self, httpbin):
|
||||
r = http('--form', '--verbose', 'POST', httpbin.url + '/post',
|
||||
r = http('--form', '--verbose', 'POST', httpbin + '/post',
|
||||
f'test-file@{FILE_PATH_ARG}', 'foo=bar')
|
||||
assert HTTP_OK in r
|
||||
assert 'Content-Disposition: form-data; name="foo"' in r
|
||||
@ -206,7 +206,7 @@ class TestMultipartFormDataFileUpload:
|
||||
assert 'Content-Type: text/plain' in r
|
||||
|
||||
def test_upload_multiple_fields_with_the_same_name(self, httpbin):
|
||||
r = http('--form', '--verbose', 'POST', httpbin.url + '/post',
|
||||
r = http('--form', '--verbose', 'POST', httpbin + '/post',
|
||||
f'test-file@{FILE_PATH_ARG}',
|
||||
f'test-file@{FILE_PATH_ARG}')
|
||||
assert HTTP_OK in r
|
||||
@ -221,7 +221,7 @@ class TestMultipartFormDataFileUpload:
|
||||
r = http(
|
||||
'--form',
|
||||
'--verbose',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
f'test-file@{FILE_PATH_ARG};type=image/vnd.microsoft.icon'
|
||||
)
|
||||
assert HTTP_OK in r
|
||||
@ -235,7 +235,7 @@ class TestMultipartFormDataFileUpload:
|
||||
r = http(
|
||||
'--form',
|
||||
'--verbose',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
'AAAA=AAA',
|
||||
'BBB=BBB',
|
||||
)
|
||||
@ -246,7 +246,7 @@ class TestMultipartFormDataFileUpload:
|
||||
r = http(
|
||||
'--verbose',
|
||||
'--multipart',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
'AAAA=AAA',
|
||||
'BBB=BBB',
|
||||
)
|
||||
@ -261,7 +261,7 @@ class TestMultipartFormDataFileUpload:
|
||||
'--check-status',
|
||||
'--multipart',
|
||||
f'--boundary={boundary}',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
'AAAA=AAA',
|
||||
'BBB=BBB',
|
||||
)
|
||||
@ -275,7 +275,7 @@ class TestMultipartFormDataFileUpload:
|
||||
'--check-status',
|
||||
'--multipart',
|
||||
f'--boundary={boundary}',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
'Content-Type: multipart/magic',
|
||||
'AAAA=AAA',
|
||||
'BBB=BBB',
|
||||
@ -292,7 +292,7 @@ class TestMultipartFormDataFileUpload:
|
||||
'--check-status',
|
||||
'--multipart',
|
||||
f'--boundary={boundary_in_body}',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
f'Content-Type: multipart/magic; boundary={boundary_in_header}',
|
||||
'AAAA=AAA',
|
||||
'BBB=BBB',
|
||||
@ -342,7 +342,7 @@ class TestRequestBodyFromFilePath:
|
||||
def test_request_body_from_file_by_path(self, httpbin):
|
||||
r = http(
|
||||
'--verbose',
|
||||
'POST', httpbin.url + '/post',
|
||||
'POST', httpbin + '/post',
|
||||
'@' + FILE_PATH_ARG,
|
||||
)
|
||||
assert HTTP_OK in r
|
||||
@ -363,7 +363,7 @@ class TestRequestBodyFromFilePath:
|
||||
def test_request_body_from_file_by_path_with_explicit_content_type(
|
||||
self, httpbin):
|
||||
r = http('--verbose',
|
||||
'POST', httpbin.url + '/post', '@' + FILE_PATH_ARG,
|
||||
'POST', httpbin + '/post', '@' + FILE_PATH_ARG,
|
||||
'Content-Type:text/plain; charset=UTF-8')
|
||||
assert HTTP_OK in r
|
||||
assert FILE_CONTENT in r
|
||||
@ -372,7 +372,7 @@ class TestRequestBodyFromFilePath:
|
||||
def test_request_body_from_file_by_path_no_field_name_allowed(
|
||||
self, httpbin):
|
||||
env = MockEnvironment(stdin_isatty=True)
|
||||
r = http('POST', httpbin.url + '/post', 'field-name@' + FILE_PATH_ARG,
|
||||
r = http('POST', httpbin + '/post', 'field-name@' + FILE_PATH_ARG,
|
||||
env=env, tolerate_error_exit_status=True)
|
||||
assert 'perhaps you meant --form?' in r.stderr
|
||||
|
||||
@ -381,7 +381,7 @@ class TestRequestBodyFromFilePath:
|
||||
env = MockEnvironment(stdin_isatty=False)
|
||||
r = http(
|
||||
'POST',
|
||||
httpbin.url + '/post',
|
||||
httpbin + '/post',
|
||||
'@' + FILE_PATH_ARG, 'foo=bar',
|
||||
env=env,
|
||||
tolerate_error_exit_status=True,
|
||||
@ -393,7 +393,7 @@ class TestRequestBodyFromFilePath:
|
||||
env = MockEnvironment(stdin_isatty=True)
|
||||
r = http(
|
||||
'--verbose',
|
||||
'POST', httpbin.url + '/post',
|
||||
'POST', httpbin + '/post',
|
||||
'@' + FILE_PATH_ARG,
|
||||
'@' + FILE_PATH_ARG,
|
||||
env=env,
|
||||
|
@ -12,7 +12,7 @@ class TestWindowsOnly:
|
||||
reason='this test for some reason kills the process')
|
||||
def test_windows_colorized_output(self, httpbin):
|
||||
# Spits out the colorized output.
|
||||
http(httpbin.url + '/get', env=Environment())
|
||||
http(httpbin + '/get', env=Environment())
|
||||
|
||||
|
||||
class TestFakeWindows:
|
||||
@ -20,6 +20,6 @@ class TestFakeWindows:
|
||||
env = MockEnvironment(is_windows=True)
|
||||
output_file = tmp_path / 'test_output_file_pretty_not_allowed_on_windows'
|
||||
r = http('--output', str(output_file),
|
||||
'--pretty=all', 'GET', httpbin.url + '/get',
|
||||
'--pretty=all', 'GET', httpbin + '/get',
|
||||
env=env, tolerate_error_exit_status=True)
|
||||
assert 'Only terminal output can be colorized on Windows' in r.stderr
|
||||
|
@ -210,7 +210,7 @@ class BaseCLIResponse:
|
||||
complete_args: List[str] = []
|
||||
|
||||
@property
|
||||
def command(self):
|
||||
def command(self): # noqa: F811
|
||||
cmd = ' '.join(shlex.quote(arg) for arg in ['http', *self.args])
|
||||
# pytest-httpbin to real httpbin.
|
||||
return re.sub(r'127\.0\.0\.1:\d+', 'httpbin.org', cmd)
|
||||
@ -360,7 +360,7 @@ def http(
|
||||
$ http --auth=user:password GET pie.dev/basic-auth/user/password
|
||||
|
||||
>>> httpbin = getfixture('httpbin')
|
||||
>>> r = http('-a', 'user:pw', httpbin.url + '/basic-auth/user/pw')
|
||||
>>> r = http('-a', 'user:pw', httpbin + '/basic-auth/user/pw')
|
||||
>>> type(r) == StrCLIResponse
|
||||
True
|
||||
>>> r.exit_status is ExitStatus.SUCCESS
|
||||
|
Reference in New Issue
Block a user