diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 84391811..82c47a18 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,13 +6,15 @@ This document records all notable changes to `HTTPie `_. This project adheres to `Semantic Versioning `_. -`2.3.0-dev`_ (unreleased) +`2.3.0`_ (2020-10-25) ------------------------- +* Added support for streamed uploads (`#201`_). * Added support for multipart upload streaming (`#684`_). * Added support for body-from-file upload streaming (``http httpbin.org/post @file``). -* Added ``--chunked`` to allow chunked transfer encoding. +* Added ``--chunked`` to enable chunked transfer encoding (`#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`_). * 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`_). * Added out of the box SOCKS support with no extra installation (`#904`_). @@ -452,20 +454,23 @@ This project adheres to `Semantic Versioning `_. .. _2.0.0: https://github.com/jakubroztocil/httpie/compare/1.0.3...2.0.0 .. _2.1.0: https://github.com/jakubroztocil/httpie/compare/2.0.0...2.1.0 .. _2.2.0: https://github.com/jakubroztocil/httpie/compare/2.1.0...2.2.0 -.. _2.3.0-dev: https://github.com/jakubroztocil/httpie/compare/2.2.0...master +.. _2.3.0: https://github.com/jakubroztocil/httpie/compare/2.2.0...2.3.0 .. _#128: https://github.com/jakubroztocil/httpie/issues/128 +.. _#201: https://github.com/jakubroztocil/httpie/issues/201 .. _#488: https://github.com/jakubroztocil/httpie/issues/488 .. _#668: https://github.com/jakubroztocil/httpie/issues/668 .. _#684: https://github.com/jakubroztocil/httpie/issues/684 .. _#718: https://github.com/jakubroztocil/httpie/issues/718 .. _#719: https://github.com/jakubroztocil/httpie/issues/719 +.. _#753: https://github.com/jakubroztocil/httpie/issues/753 .. _#840: https://github.com/jakubroztocil/httpie/issues/840 .. _#853: https://github.com/jakubroztocil/httpie/issues/853 .. _#852: https://github.com/jakubroztocil/httpie/issues/852 .. _#870: https://github.com/jakubroztocil/httpie/issues/870 .. _#895: https://github.com/jakubroztocil/httpie/issues/895 +.. _#903: https://github.com/jakubroztocil/httpie/issues/903 .. _#920: https://github.com/jakubroztocil/httpie/issues/920 .. _#904: https://github.com/jakubroztocil/httpie/issues/904 .. _#925: https://github.com/jakubroztocil/httpie/issues/925 diff --git a/Makefile b/Makefile index e998cbfa..56754cc1 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ # See ./CONTRIBUTING.rst ############################################################################### +.PHONY: build + ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) VERSION=$(shell grep __version__ httpie/__init__.py) REQUIREMENTS=requirements-dev.txt @@ -111,6 +113,9 @@ test-bdist-wheel: clean venv @echo +twine-check: + twine check dist/* + pycodestyle: @echo $(H1)Running pycodestyle$(H1END) @[ -f $(VENV_BIN)/pycodestyle ] || $(VENV_PIP) install pycodestyle @@ -131,6 +136,11 @@ codecov-upload: ############################################################################### +build: + rm -rf build/ + $(VENV_PYTHON) setup.py sdist bdist_wheel + + publish: test-all publish-no-test @@ -138,7 +148,8 @@ publish-no-test: @echo $(H1)Testing wheel build an installation$(H1END) @echo "$(VERSION)" @echo "$(VERSION)" | grep -q "dev" && echo '!!!Not publishing dev version!!!' && exit 1 || echo ok - $(VENV_PYTHON) setup.py sdist bdist_wheel + make build + make twine-check $(VENV_BIN)/twine upload dist/* @echo diff --git a/README.rst b/README.rst index 68fc688d..b0a07e97 100644 --- a/README.rst +++ b/README.rst @@ -538,6 +538,7 @@ Simple example: $ http PUT httpbin.org/put name=John email=john@example.org .. code-block:: http + PUT / HTTP/1.1 Accept: application/json, */*;q=0.5 Accept-Encoding: gzip, deflate diff --git a/httpie/__init__.py b/httpie/__init__.py index 3b912382..540473e7 100644 --- a/httpie/__init__.py +++ b/httpie/__init__.py @@ -3,6 +3,6 @@ HTTPie: command-line HTTP client for the API era. """ -__version__ = '2.3.0-dev' +__version__ = '2.3.0' __author__ = 'Jakub Roztocil' __licence__ = 'BSD' diff --git a/httpie/core.py b/httpie/core.py index a316d4ea..5092c5ea 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -159,7 +159,7 @@ def program( def maybe_separate(): nonlocal needs_separator - if env.stdout.isatty() and needs_separator: + if env.stdout_isatty and needs_separator: needs_separator = False getattr(env.stdout, 'buffer', env.stdout).write(b'\n\n') diff --git a/setup.py b/setup.py index ef60d351..85bd731c 100644 --- a/setup.py +++ b/setup.py @@ -18,8 +18,10 @@ class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) self.test_args = [ - '--doctest-modules', '--verbose', - './httpie', './tests' + '--doctest-modules', + '--verbose', + './httpie', + './tests', ] self.test_suite = True @@ -71,8 +73,9 @@ setup( version=httpie.__version__, description=httpie.__doc__.strip(), long_description=long_description(), + long_description_content_type='text/x-rst', url='https://httpie.org/', - download_url=f'https://github.com/jakubroztocil/httpie/archive/{httpie.__version__}.tar.gz', + download_url=f'https://github.com/httpie/httpie/archive/{httpie.__version__}.tar.gz', author=httpie.__author__, author_email='jakub@roztocil.co', license=httpie.__licence__, @@ -104,10 +107,10 @@ setup( 'Topic :: Utilities' ], project_urls={ + 'GitHub': 'https://github.com/httpie/httpie', + 'Twitter': 'https://twitter.com/httpie', 'Documentation': 'https://httpie.org/docs', - 'Source': 'https://github.com/jakubroztocil/httpie', 'Online Demo': 'https://httpie.org/run', 'Donate': 'https://httpie.org/donate', - 'Twitter': 'https://twitter.com/httpie', }, ) diff --git a/tests/test_uploads.py b/tests/test_uploads.py index 7e3d2a88..05fb2001 100644 --- a/tests/test_uploads.py +++ b/tests/test_uploads.py @@ -52,6 +52,23 @@ def test_chunked_stdin(): assert r.count(FILE_CONTENT) == 2 +def test_chunked_stdin_multiple_chunks(): + stdin_bytes = FILE_PATH.read_bytes() + b'\n' + FILE_PATH.read_bytes() + r = http( + '--verbose', + '--chunked', + HTTPBIN_WITH_CHUNKED_SUPPORT + '/post', + env=MockEnvironment( + stdin=StdinBytesIO(stdin_bytes), + stdin_isatty=False, + stdout_isatty=True, + ) + ) + assert HTTP_OK in r + assert 'Transfer-Encoding: chunked' in r + assert r.count(FILE_CONTENT) == 4 + + class TestMultipartFormDataFileUpload: def test_non_existent_file_raises_parse_error(self, httpbin):