Commit Graph

84 Commits

Author SHA1 Message Date
Batuhan Taskaya
f1ea486025
Fix escaping of integer indexes with multiple backslashes (#1288) 2022-02-01 02:10:55 -08:00
Batuhan Taskaya
dc30919893 use constants 2022-01-13 19:54:43 +03:00
Batuhan Taskaya
fb82f44cd1 Use enums 2022-01-13 19:54:43 +03:00
Batuhan Taskaya
eb4e32ca28 A few edits 2022-01-13 19:54:43 +03:00
Batuhan Taskaya
2cda966384 Implement escaped integers 2022-01-13 19:54:43 +03:00
Batuhan Taskaya
7bf373751d Implement HTTPie Nested JSON v2 2022-01-13 19:54:43 +03:00
Sebastian Czech
17ed3bb8c5
Store prompted passwords in local sessions (#1239)
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2021-12-29 12:00:47 +03:00
Batuhan Taskaya
05c02f0f39 Update shortcuts as well 2021-12-24 11:53:31 +03:00
Batuhan Taskaya
0ebc9a7e09 Mention about levels in -v 2021-12-24 11:53:15 +03:00
Batuhan Taskaya
c692669526 Fix -v docs to include BASE_OUTPUT_OPTIONS 2021-12-24 11:51:11 +03:00
Batuhan Taskaya
747accc2ae Include response metadata in --print help 2021-12-24 11:50:19 +03:00
Batuhan Taskaya
f3b500119c
Implement basic metrics layout & total elapsed time (#1250)
* Initial metadata processing

* Dynamic coloring and other stuff

* Use -vv / --meta

* More testing

* Cleanup

* Tweek message

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-12-23 12:13:25 -08:00
Batuhan Taskaya
be87da8bbd
Formalize @ suffix for all operators (#1225)
* Formalize @ suffix for all operators

* Separate the section

* Address suggestions
2021-12-23 11:06:35 -08:00
Batuhan Taskaya
df58ec683e
Add nested JSON syntax to the HTTPie DSL (#1224)
* Add support for nested JSON syntax (#1169)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* minor improvements

* unpack top level lists

* Write more docs

* doc style changes

* fix double quotes

Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-12-03 02:17:45 -08:00
Batuhan Taskaya
151becec2b
Improve startup time with lazy loading some args (#1221)
* Improve startup time with lazy loading some args

* add some tests

* Add changelog entry

* Update CHANGELOG.md

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-12-01 10:15:59 -08:00
Batuhan Taskaya
ba8e4097e8
Support ==@ syntax for query parameter values from file (#1218)
Co-authored-by: Vladimir Berkutov <vladimir.berkutov@gmail.com>

Co-authored-by: Vladimir Berkutov <vladimir.berkutov@gmail.com>
2021-12-01 10:09:39 -08:00
Batuhan Taskaya
00b366a81f
Implement Bearer Auth (#1216) 2021-12-01 09:37:57 -08:00
Batuhan Taskaya
245cede2c2
cmd: Implement httpie plugins interface (#1200) 2021-11-30 11:12:51 +03:00
Batuhan Taskaya
6bdcdf1eba
Proper JSON handling for :=/:=@ (#1213)
* Proper JSON handling for :=/:=@

* document the behavior

* fixup docs
2021-11-26 03:45:46 -08:00
Batuhan Taskaya
c000886546
Preserve individual headers with the same name on responses (#1208)
* Preserve individual headers with the same name on responses

* Rename RequestHeadersDict to HTTPHeadersDict

* Update tests/utils/http_server.py

* Update tests/utils/http_server.py

* Update httpie/adapters.py

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-11-24 15:41:37 -08:00
Jakub Roztocil
861b8b36a8
Strip leading :// from URLs to allow quick conversion of a pasted URL to calls (#1197)
* Strip leading `://` from URLs to allow quick conversion of a pasted URL to calls

Closes #1195

* Markdown lint

* Cleanup

* Cleanup

* Drop extraneous space

* Fix example
2021-11-05 13:59:23 +01:00
Batuhan Taskaya
7cdd74fece
Support multiple headers sharing the same name (#1190)
* Support multiple headers sharing the same name

* Apply suggestions

* Don't normalize HTTP header names

* apply visual suggestions

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* bump down multidict to 4.7.0

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-10-31 15:04:39 +01:00
Mickaël Schoentgen
3abc76f6d5 Tiny docstring clean-up 2021-10-19 10:24:01 +02:00
dkreeft
6befaf9067
Added the ability to silence warnings via double -q or --quiet (#1175)
* change behavior of '--quiet' to silence errors and warnings when passed twice together with '--check-status'

* Apply suggestions from code review

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* remove header, trailing comma, rename constant and variable

* fix flags for tests

* [skip ci] Update ticket number

Co-authored-by: Dave <d.kreeft@outlook.com>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
Co-authored-by: Mickaël Schoentgen <contact@tiger-222.fr>
2021-10-08 14:18:11 +02:00
Mickaël Schoentgen
50f57f8c82
Add help output for --chunked (#1174) 2021-10-07 17:37:06 +02:00
Mickaël Schoentgen
4f1c9441c5
Fix encoding error with non-prettified encoded responses (#1168)
* Fix encoding error with non-prettified encoded responses

Removed `--format-option response.as` an promote `--response-as`: using
the format option would be misleading as it is now also used by non-prettified
responses.

* Encoding refactoring

* split --response-as into --response-mime and --response-charset
* add support for Content-Type charset for requests printed to terminal
* add support charset detection for requests printed to terminal without a Content-Type charset
* etc.

* `test_unicode.py` → `test_encoding.py`

* Drop sequence length check

* Clean-up tests

* [skip ci] Tweaks

* Use the compatible release clause for `charset_normalizer` requirement

Cf. https://www.python.org/dev/peps/pep-0440/#version-specifiers

* Clean-up

* Partially revert d52a4833e4

* Changelog

* Tweak tests

* [skip ci] Better test name

* Cleanup tests and add request body charset detection

* More test suite cleanups

* Cleanup

* Fix code style in test

* Improve detect_encoding() docstring

* Uniformize pytest.mark.parametrize() calls

* [skip ci] Comment out TODOs (will be tackled in a specific PR)

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-10-06 17:27:07 +02:00
Mickaël Schoentgen
71adcd97d0
Improve handling of prettified responses without correct content-type encoding (#1110)
* Improve handling of responses without correct content-type charset

* [skip ci] Minor tweaks in tests

* [skip ci] Add documentation

Co-authored-by: claudiatd <claudiatd@gmail.com>

* Improve unknown encoding test

[skip ci]

* Review mime and options retrieval

* Add full content-type example in help output

* Simplify decoder

* [skip ci] s/charset/encoding/

* Tweaks

* [skip ci] Fix type annotation

* [skip ci] s/charset/encoding/

* Tweaks

* Fix type annoation

* Improvement

* Introduce `codec.encode()`

* [skip ci] Tweak changelog

Co-authored-by: claudiatd <claudiatd@gmail.com>
2021-09-29 20:22:19 +02:00
Mickaël Schoentgen
fe96b2af20 Use httpie.io/docs everywhere
[skip ci]
2021-09-28 12:53:53 +02:00
Mickaël Schoentgen
727b8a2c05
Sort available style choices (#1166) 2021-09-27 16:55:10 +02:00
Mickaël Schoentgen
9c89c703ae
Allow to overwrite the response Content-Type from options (#1134)
* Allow to override the response `Content-Type` from options

* Apply suggestions from code review

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Rename the option from `--response.content-type` to `--response-as`

* Update CHANGELOG.md

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-09-27 13:58:19 +02:00
Mickaël Schoentgen
d7ed45bbcd
Fix duplicate keys preservation of JSON data (#1163)
* Fix duplicate keys preservation of JSON data

* Update issue number

* Fix type annotations

* Changes after review

* Rewording
2021-09-21 19:07:59 +02:00
Jakub Roztocil
6c501d23c3 Change default XML indent to 2 spaces 2021-08-31 22:52:16 +02:00
Mickaël Schoentgen
d10e108b5f
Added support for XML formatting (#1129)
As a side effect, XHTML responses will be pretty-printed too.
2021-08-31 22:49:53 +02:00
Mickaël Schoentgen
c6cbc7dfa5
Uniformize UTF-8 naming (#1115)
* Uniformize UTF-8 naming

Replace `utf8` -> `utf-8` everywhere.
It should have no impact, `utf8` is an alias of `utf-8` [1].

[1] ee03bad25e/Lib/encodings/aliases.py (L534)

* Always specify the encoding

Let's be explicit over implicit. And prevent future warnings from PEP-597 [1].

[1] https://www.python.org/dev/peps/pep-0597/#using-the-default-encoding-is-a-common-mistake

* Update `UTF8` constant (`utf-8` -> `utf_8`)

* Remove default argument from `str.encode()` and `bytes.decode()`

* Clean-up
2021-08-05 20:58:43 +02:00
Mickaël Schoentgen
8d35a12d27
Fix several issues found with flake8 (#1081) 2021-06-01 14:46:58 +02:00
Mickaël Schoentgen
8374a9ed83
Review OSError exceptions handling (#1080)
- Replace obsolete `IOError` (Python 2) with `OSError`,
  cf https://docs.python.org/3/library/exceptions.html#OSError.
- Improve `OSError` catches at different places, simplifying
  the code.
2021-05-31 10:10:41 +02:00
Mickaël Schoentgen
611b278b63
Fix --style colors list help indentation (#1077) 2021-05-28 12:45:40 +02:00
Mickaël Schoentgen
0ff0874fa3
Modernize the code base with f-strings (#1068) 2021-05-25 20:49:07 +02:00
Mickaël Schoentgen
0001297f41
Add --raw to allow specifying the raw request body as an alternative to stdin (#1062)
* Add --raw to allow specifying the raw request body without extra processing

As an alternative to `stdin`.

Co-authored-by: Elena Lape <elapinskaite@gmail.com>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Update README.rst

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Update README.rst

Co-authored-by: Jakub Roztocil <jakub@roztocil.co>

* Fix default HTTP method on empty data

Co-authored-by: Elena Lape <elapinskaite@gmail.com>
Co-authored-by: Jakub Roztocil <jakub@roztocil.co>
2021-05-24 14:29:54 +02:00
Mickaël Schoentgen
a3a08a9a22
Use relative imports (#1057)
* Use relative imports in test

* Use relative imports

* Add myself to contributors :)
2021-05-05 14:13:39 +02:00
Jan Verbeek
611bcdaab1
Fail gracefully if multiple request data files are supplied (#1042) 2021-04-15 09:35:50 +02:00
Jakub Roztocil
2afdc958c6 Update URLs 2020-12-23 22:07:27 +01:00
Shubhendra Singh Chauhan
9883a46575
Cleanup (#993) 2020-12-21 12:03:25 +01:00
Jakub Roztocil
6925d930da Add support for streamed uploads, --chunked, finish --multipart, etc.
Close #201
Close #753
Close #684
Close #903
Related: #452
2020-09-28 12:16:57 +02:00
Jakub Roztocil
b7754f92ce Merge branch 'master' into feature/uploads2020
# Conflicts:
#	httpie/cli/argparser.py
#	httpie/uploads.py
2020-09-25 14:46:19 +02:00
Jakub Roztocil
e4e40e5b06 Request content type 2020-09-25 14:44:22 +02:00
Jakub Roztocil
d12af4a569 WIP 2020-09-25 13:44:28 +02:00
Jakub Roztocil
1813cf6156 Add --multipart and --boundary 2020-08-19 10:22:50 +02:00
Jakub Roztocil
6cd934d1b8 Add support for multipart upload streaming
Close #684, #201
2020-08-15 17:50:00 +02:00
Nicolas Beltran
c90d039a0b fixed issues related to downloading and using quiet at the same time 2020-08-15 15:26:29 +02:00