Commit Graph

362 Commits

Author SHA1 Message Date
Jakub Roztocil
6e7e2f2eea Changed the default JSON Content-Type to application/json. 2015-02-14 17:45:15 +01:00
Marc Abramowitz
873102d5eb Mark test_session_unicode as xfail
There are known problems with unicode in headers.
See https://github.com/jakubroztocil/httpie/issues/282
2015-02-10 06:52:51 -08:00
Jakub Roztocil
a5a83c5b77 Prevent a circular import issue. 2015-02-07 16:29:17 +01:00
Jakub Roztocil
b125ce5eae Allow custom URL schemes
Closes #299

See also #276
2015-02-05 14:35:34 +01:00
Jakub Roztocil
12f2d99bfd Added test client SSL certs 2015-01-23 23:56:08 +01:00
Jakub Roztocil
5fbafc18bc Added tests for client as well as server SSL certificate handling. 2015-01-23 23:55:03 +01:00
Jakub Roztocil
25b1be7c8a Work around missing object_pairs_hook in Python 2.6 2015-01-23 22:04:42 +01:00
Jakub Roztocil
22c993bab8 Merge branch 'fix-268' of https://github.com/asnelzin/httpie into asnelzin-fix-268 2015-01-23 21:45:09 +01:00
Jakub Roztocil
b2ec4f797f Exit with 0 for --version and --help (closes #293). 2015-01-19 15:39:46 +01:00
Alexander Nelzin
a2b12f75ea Fixed and added test for JSON properties order. 2014-11-13 23:56:05 +03:00
Jakub Roztocil
0481957715 Fixed multiple uploads with the same field name
Closes #267
2014-10-20 14:41:48 +02:00
Dennis Brakhane
f1cd289d51 Fallback to JSON highlighting if subtype contains json
Some JSON based formats like JSON Home Documents[1] don't
use a '+json' suffix, but simply contain json in their
MIME type. Also, some servers might use (outdated)
types like 'application/x-json'.

The JSON formatter can already handle those cases,
but the highlighter was ignoring them.

This commit will let the highlighter choose the JSON
lexer if no other lexer could be found and the MIME subtype
contains 'json'

[1] http://tools.ietf.org/html/draft-nottingham-json-home-03
2014-09-25 00:10:06 +02:00
Jakub Roztocil
b0effe07d9 Fixed --output=/dev/null on Linux
Closes #252
2014-09-07 10:22:21 +02:00
Jakub Roztocil
5084f18568 '\' only escapes separator characters in req-items
It makes easier to work with Windows paths.

Closes #253, #254
2014-09-05 18:36:23 +02:00
Jakub Roztocil
1035710956 Added RequestItems named tuple for convenience. 2014-09-05 07:51:35 +02:00
Jakub Roztocil
ca36f1de04 Handle empty passwords in URL credentials
Closes #242
2014-07-18 13:39:47 +02:00
Jakub Roztocil
529f3bd9b6 Fixed python setup.py test 2014-06-28 19:52:10 +02:00
Jakub Roztocil
2a72ae23d5 Run tests against local httpbin instance via pytest-httpbin. 2014-06-28 16:38:41 +02:00
Jakub Roztocil
040d981f00 Fixed custom Host
Closes #235
2014-06-28 13:24:14 +02:00
Jakub Roztocil
8e170b059c Fixed tests. 2014-06-03 19:45:57 +02:00
Jakub Roztocil
77955c9837 Fixed --timeout
* Require requests >= 2.3.0
* Updated test_timeout_exit_status

Close #185.
2014-05-17 22:33:16 +02:00
Jakub Roztocil
e4c68063b9 Converted built-in formatters to formatter plugins.
Still work in progress and the API should be considered private for now.
2014-05-12 19:12:39 +02:00
Jakub Roztocil
858555abb5 Make sure session and default headers play nice
Before: headers = default + args + session
Now:    headers = default + session + args

Fixes #180
2014-05-08 12:27:50 +01:00
Jakub Roztocil
d9eca19b8f New URL. 2014-05-05 21:17:23 +02:00
Jakub Roztocil
29a564ef56 Added wheel support
Should make installation via pip work on OSX Mavericks (#148).

Also added a nifty Makefile.
2014-04-28 13:25:47 +02:00
Jakub Roztocil
2aa53e4be3 Avoid “__init__.py” files in test directories.
As recommended here:

	https://pytest.org/latest/goodpractises.html
2014-04-28 11:29:41 +02:00
Jakub Roztocil
faec00fd99 Improve support for 'type/subtype+suffix' mime types in the colors output formatter.
E.g.:
* application/ld+json
* application/hal+json

Closes #189, #206
2014-04-28 10:08:03 +02:00
Jakub Roztocil
76ab8b84be Cleanup 2014-04-28 10:01:56 +02:00
Jakub Roztocil
05db75bdb1 Modularized output, refactoring
Making it ready for output formatting plugin API.
2014-04-27 21:58:00 +02:00
Jakub Roztocil
87806acc56 Cleanup 2014-04-26 23:06:39 +02:00
Jakub Roztocil
1169a3eb23 Fixed tests. 2014-04-26 20:14:46 +02:00
Jakub Roztocil
43bc6d0c98 Fixed and added tests for --verbose with unicode headers. 2014-04-26 20:10:15 +02:00
Jakub Roztocil
eca1ffaedb More unicode. 2014-04-26 19:47:14 +02:00
Jakub Roztocil
0bd218eab0 Cleanup 2014-04-26 19:32:08 +02:00
Jakub Roztocil
bbc820bf2e Fixed fixture loading on Windows. 2014-04-26 18:41:28 +02:00
Jakub Roztocil
84a521a827 Added test_unicode_url_query_arg_item. 2014-04-26 18:23:13 +02:00
Jakub Roztocil
a3352af1d4 Added support and tests for unicode support in sessions. 2014-04-26 18:16:30 +02:00
Jakub Roztocil
3478cbd9ff More unicode tests. 2014-04-26 17:53:01 +02:00
Jakub Roztocil
77dcd6e919 Added unicode characters to json fixture. 2014-04-26 17:37:56 +02:00
Jakub Roztocil
467d126b6c Python 3 unicode fixes. 2014-04-26 17:35:26 +02:00
Jakub Roztocil
15e62ad26d Implemented more robust unicode handling.
* Immediatelly convert all args from `bytes` to `str`.
* Added `Environment.stdin_encoding` and `Environment.stdout_encoding`
* Allow unicode characters in HTTP headers and basic auth credentials
  by encoding them using UTF8 instead of latin1 (#212).
2014-04-26 15:07:31 +02:00
Jakub Roztocil
0c45c7cb39 Disabled test_windows_colorized_output 2014-04-26 11:06:50 +02:00
Jakub Roztocil
631e332dad Cleanup 2014-04-25 13:57:33 +02:00
Jakub Roztocil
33422312c5 Cleanup 2014-04-25 13:52:43 +02:00
Jakub Roztocil
1d987c5b4d Improved session tests. 2014-04-25 13:50:44 +02:00
Jakub Roztocil
3c2de34285 Improved auth tests. 2014-04-25 13:10:01 +02:00
Jakub Roztocil
492ee392bd Cleanup 2014-04-25 12:42:50 +02:00
Jakub Roztocil
af4aa3a761 Test improvements. 2014-04-25 12:18:35 +02:00
Jakub Roztocil
27faf06327 Removed last dependencies on unittest. All tests are pytest-only. 2014-04-25 11:39:59 +02:00
Jakub Roztocil
f658d24c93 Parametrize test_docs.py. 2014-04-25 10:41:04 +02:00
Jakub Roztocil
f02169ea71 Added Python 2.6 compatible OrderedDict
To preserver ordr of headers, parameters, etc.
2014-04-24 19:57:19 +02:00
Jakub Roztocil
e5d758e4ce More tests. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
ce2169f4fe Added docstrings for utilities in tests.__init__. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
bdea7be456 Added tests for --debug and --help. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
887f70f595 Added CONTRIBUTING.rst. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
3d079942f4 Finished pytest migration. 2014-04-24 19:32:55 +02:00
Jakub Roztocil
3cb124bba7 Cleanup
XX
2014-04-24 19:32:50 +02:00
Jakub Roztocil
6f28624134 Switched to @pytest.mark.skipif. 2014-04-24 15:17:23 +02:00
Jakub Roztocil
941c0a8c3c Moved fixture constants to tests.fixtures. 2014-04-24 15:17:04 +02:00
Jakub Roztocil
b880e996d0 Converted all unittest asserts to plain, pytest-powered asserts. 2014-04-24 14:58:15 +02:00
Jakub Roztocil
6071fff4af Refactored tests into smaller modules. 2014-04-24 14:07:31 +02:00
Jakub Roztocil
746a1899f3 Skip ExitStatusTest.test_timeout_exit_status until timeout gets fixed in requests. 2014-03-31 13:01:55 +02:00
Jakub Roztocil
bbbae3ae25 Fixed SessionTest.test_session_read_only. 2014-03-31 13:01:55 +02:00
Jakub Roztocil
e0cc63c7eb Cleanup 2014-01-25 15:09:28 +01:00
Nathan LaFreniere
8a52bef559 make shorthand parsing more robust, add unit tests and documentation 2013-10-09 11:32:41 -07:00
Jakub Roztocil
0bcd4d2fb0 Fixed a bytes/str issue for Python 3. 2013-09-25 00:00:17 +02:00
Jakub Roztocil
d5bc564e4f Allow embeding text (=@) and JSON (:=@) files content into request data fields. 2013-09-24 23:41:18 +02:00
Jakub Roztocil
2a6514eb5d Update to requests 2.0.0
Closes #140.
2013-09-24 21:49:43 +02:00
Jakub Roztocil
29f6b6a2a9 Improved Content-Disposition parsing for --download mode
Closes #168.
2013-09-24 19:50:37 +02:00
Jakub Roztocil
f7b703b4bf Added --ignore-stdin
Closes #150
2013-08-23 10:57:17 +02:00
Jakub Roztocil
00de49f4c3 Cleanup 2013-08-18 00:59:10 +02:00
Jakub Roztocil
383dba524a Print error when download is interrupted by server
Close #147
2013-07-07 17:00:03 +02:00
Jakub Roztocil
c3d550e930 Fixed headers tests; Require requests>=1.2.3. 2013-06-02 20:47:29 +02:00
Jakub Roztocil
8e112a6948 test_download_no_Content_Length 2013-05-13 15:35:12 +02:00
Jakub Roztocil
87c59ae561 Added anonymous sessions (--session=/file/path.json). 2013-05-13 14:47:44 +02:00
Jakub Roztocil
e09b74021c Ignore Content-* and If-* request headers.
Those headers are not stored in sessions anymore.

Closes #141.
2013-05-13 11:54:49 +02:00
Jakub Roztocil
71e7061014 v0.5.0 2013-04-27 12:03:38 -03:00
Jakub Roztocil
bc756cb6a2 Cleanup 2013-04-27 11:57:13 -03:00
Jakub Roztocil
1fc8396c4b Stop the progres reporter thread on error. 2013-04-16 04:55:45 -03:00
Jakub Roztocil
6c3b983c18 Tests 2013-04-15 00:56:47 -03:00
Jakub Roztocil
cfa7199f0b Added a simple download test. 2013-04-13 15:34:31 -03:00
Jakub Roztocil
5a1177d57e Fixed downloads with no Content-Length. 2013-04-13 14:50:46 -03:00
Jakub Roztocil
d17e02792b Fixed length progress bar. 2013-04-12 21:49:27 -03:00
Jakub Roztocil
1681a4ddd0 TODOs 2013-04-12 15:27:26 -03:00
Jakub Roztocil
72cf7c2cb7 Fixed tests for Python 2.6. 2013-04-12 13:42:34 -03:00
Jakub Roztocil
464b7a36da Tests 2013-04-12 10:20:01 -03:00
Jakub Roztocil
674acfe2c2 Cleanup 2013-04-11 16:23:15 -03:00
Jakub Roztocil
7ccdece39f Cleanup 2013-04-11 04:00:41 -03:00
Jakub Roztocil
e53dcba03e Added Content-Range parsing tests.
#104
2013-04-11 03:49:01 -03:00
Jakub Roztocil
6e5c696ac9 --json with no data sets Content-Type as well
Closes #137
2013-04-02 11:07:14 -03:00
Jakub Roztocil
8e6c765be2 Initial --download implementation (#104).
Closes #127
2013-03-03 22:17:09 -03:00
Jakub Roztocil
d7ec7b2217 Fixing tests for Travis. 2013-01-04 03:19:38 +01:00
Jakub Roztocil
7817dfbbcc Fixing tests for Travis. 2013-01-04 03:09:21 +01:00
Jakub Roztocil
238b2e0441 Fixing tests for Travis. 2013-01-04 03:05:36 +01:00
Jakub Roztocil
a93d57b58b Fixed request/response session cookies.
Closes #113.
2013-01-04 02:59:05 +01:00
Jakub Roztocil
1481749c22 Use urlsplit instead of urlparse.
Closes #118.
2013-01-03 14:12:27 +01:00
Jakub Roztocil
53caf6ae72 Cleanup 2012-12-05 05:06:06 +01:00
Jakub Roztocil
8175366f27 PEP8 2012-12-05 04:39:56 +01:00
Jakub Roztocil
d87b2aa0e5 Added support for credentials in URL.
Closes #100 🍰
2012-11-08 22:29:54 +01:00
Jakub Roztocil
5d969852c7 Added --no-option's and made args more config-friendly. 2012-09-24 06:49:12 +02:00
Jakub Roztocil
e25d64a610 0.3.0 2012-09-21 05:50:01 +02:00
Jakub Roztocil
a41dd7ac6d Allow output redirection on Windows.
Closes #88.
2012-09-21 04:30:59 +02:00
Jakub Roztocil
4a6f32a0f4 Documented config.
Also renamed `default_content_type` to `implicit_content_type` .
2012-09-17 03:08:45 +02:00
Jakub Roztocil
548bef7dff Added tests for sessions. 2012-09-17 02:15:00 +02:00
Jakub Roztocil
da0eb7db79 Renamed --allow-redirects to --follow. 2012-09-07 11:58:39 +02:00
Jakub Roztocil
4c0d7d526f Added initial support for persistent sessions. 2012-08-17 23:30:47 +02:00
Jakub Roztocil
bf03937f06 Unified output processing options under --pretty.
* --pretty=none instead of --ugly
* --pretty=all instead of --pretty
* --pretty=colors instead of --colors
* --pretty=format instead of --format
2012-08-17 21:15:37 +02:00
Jakub Roztocil
4660da949f Fixed colorized output on Windows with Python 3.
Closes #87.
2012-08-17 06:35:18 +02:00
Jakub Roztocil
68640a81b3 Use CRLF for headers in the output. 2012-08-10 01:45:07 +02:00
Jakub Roztocil
c01dd8d64a Added exit status for timed-out requests. 2012-08-09 05:24:58 +02:00
Jakub Roztocil
76feea2f68 Added README reStructuredText validation. 2012-08-07 17:20:50 +02:00
Jakub Roztocil
22a10aec4a Added --colors and --format.
Closes #59 and #82.
2012-08-07 16:59:49 +02:00
Jakub Roztocil
f6724452cf Skip tests with redirects on Requests 0.13.6. 2012-08-07 15:08:28 +02:00
Jakub Roztocil
1fbe7a6121 Improved --debug. 2012-08-07 14:50:51 +02:00
Jakub Roztocil
dd2c89412c Compatibility with Requests 0.13.6. 2012-08-07 00:07:04 +02:00
Jakub Roztocil
44e409693b Set JSON Content-Type only with data even with -j. 2012-08-06 22:14:52 +02:00
Jakub Roztocil
4e58a3849a Added exit status constants, cleaned up main(). 2012-08-04 19:22:50 +02:00
Jakub Roztocil
c7657e3c4b Streamed terminal output
`--stream` can be used to enable streaming also with `--pretty` and to ensure
a more frequent output flushing.
2012-08-04 16:35:31 +02:00
Jakub Roztocil
52e46bedda Take advantage of streaming.
It's now possible to download huge files with HTTPie, and it's often faster than curl and wget!
2012-08-01 23:21:52 +02:00
Jakub Roztocil
00d85a4b97 Fallback to media subtype if the type is uknown.
Closes #81.
2012-08-01 17:37:23 +02:00
Jakub Roztocil
90d34ffd0d Added tests for binary request data. 2012-08-01 00:52:30 +02:00
Jakub Roztocil
923a8b71bd Revorked output
Binary now works everywhere. Also added `--output FILE` for Windows.
2012-07-30 10:58:16 +02:00
Jakub Roztocil
6eed0d92eb Better error messages. 2012-07-29 07:14:54 +02:00
Jakub Roztocil
f73bfea6b8 Validate "file fields (name@/path) require --form / -f". 2012-07-29 06:58:50 +02:00
Jakub Roztocil
f5bc081fda Send filenames with multipart/form-data file uploads. 2012-07-28 13:24:44 +02:00
Jakub Roztocil
098e1d3100 Fixed multipart requests output; binary support.
* Bodies of multipart requests are correctly printed (closes #30).
* Binary requests and responses should always work (they are also suppressed
  for terminal output). So things like this work::

     http www.google.com/favicon.ico > favicon.ico
2012-07-28 05:50:12 +02:00
Jakub Roztocil
f45cc0eec0 Added docstrings, refactored input. 2012-07-26 07:23:00 +02:00
Jakub Roztocil
26a76e8243 Clean-up 2012-07-26 00:50:39 +02:00
Jakub Roztocil
f5cfd0143b Ensure that full querystring is printent with -v.
The `key==value` parameters weren't included in the Request-Line URL.

Also added tests.
2012-07-25 14:32:57 +02:00
Jakub Roztocil
7af08b6faa Allow multiple fields with the same name.
Applies to form data and URL params:

    http -f url a=1 a=2
    http url a==1 a==2
2012-07-24 17:00:02 +02:00
Jakub Roztocil
9944def703 Switched to "==" a the separator for URL params.
Also refactored item escaping.
2012-07-24 14:56:53 +02:00
Jakub Roztocil
2646ebaaed Replaced --ignore-http-status with --check-status.
The default behaviour now is to exit with 0 on HTTP errors
unless --check-status is set.
2012-07-24 01:09:14 +02:00
Jakub Roztocil
fba3912f2e Fixed tests. 2012-07-23 19:49:38 +02:00
Jakub Roztocil
0572158ba1 Added exit codes for HTTP 3xx, 4xx, 5xx (3, 4, 5).
Also added `--ignore-http-status` to ensure 0 exit status.

HTTP 3xx result in 0 exit status when `--allow-redirects` is set.
2012-07-23 19:40:50 +02:00
Jakub Roztocil
19f760450f Use local httpbin for all tests if available. 2012-07-21 14:37:05 +02:00
Jakub Roztocil
35da44309f Undebug 2012-07-21 03:26:48 +02:00
Jakub Roztocil
ced6e33230 Fixed tests. 2012-07-21 03:22:47 +02:00
Jakub Roztocil
87042f65c9 Added models.Environment().
Refactoring and general cleanup.
2012-07-21 03:14:01 +02:00
Jakub Roztocil
57fc606f6b Changed default --print to "b" if stdout piped.
If the output is piped to another program or redirected to a file,
the new default behaviour is to only print the response body.
(It can still be overriden via the ``--print`` flag.)
2012-07-20 23:43:04 +02:00
Jake Basile
24d6331d15 Added a bit of testing for the new query string parameters. 2012-07-18 21:16:08 -05:00
Jakub Roztocil
c2d70e2bb1 Clean up. 2012-07-17 07:01:30 +02:00
Jakub Roztocil
f29c458611 Python 3 fixes. 2012-07-17 01:26:21 +02:00
Oleg Churkin
df79792fd9 Added test case to verify unicode output 2012-07-17 00:09:01 +02:00
Jakub Roztocil
681b652bf9 Allow stdin data with password prompt; added tests
Closes #70
2012-07-16 23:41:27 +02:00
Jakub Roztocil
6ab03b21b4 Fixed Content-Type for requests with no data.
Closes #62.
2012-07-04 01:39:21 +02:00
Jakub Roztocil
50196be0f2 Added support for request payload from a filepath
Content-Type is detected from the filename.

Closes #57.
2012-06-29 00:45:31 +02:00
Jakub Roztocil
180313d80c Impreved tests. 2012-06-24 04:20:45 +02:00
Jakub Roztocil
926d3f5caf Tests, docs, clean-up.
Closes #54.
2012-06-24 03:45:21 +02:00
Jakub Roztocil
4613d947a8 Default to POST also when stdin redirected.
+clean up
2012-06-24 01:25:30 +02:00
Jakub Roztocil
5a47f00bac Replaced mock.Mock with argparse.Namespace to reduce deps. 2012-06-23 23:54:59 +02:00
Vladimir Berkutov
bca36f0464 Issue #54 Method suggestion proposal 2012-06-17 21:46:56 +04:00
Vladimir Berkutov
78fff98712 Issue #54 Method suggestion proposal 2012-06-16 20:08:31 +04:00
Jakub Roztocil
cbc6d02127 Fixed --verbose --form.
Closes #53
2012-06-15 16:47:55 +02:00
Jakub Roztocil
c5b1aaaa28 Major clean-up and refactoring. 2012-04-25 01:32:53 +02:00
Jakub Roztocil
67d6426360 Fixed several unicode-related issues
Closes #31 Python 3 & non-ascii arguments => UnicodeEncodeError
Closes #41 Unicode response error.
Closes #42 UnicodeEncodeError when piping Unicode output
2012-04-25 00:08:40 +02:00
Jake Basile
90af1f7422 Fixed escaping for long separators. 2012-04-18 18:18:00 -05:00
Jake Basile
c29981c633 Added ability to escape parameters... except for the := ones. 2012-04-16 20:28:08 -05:00
Jake Basile
45ce446017 -j/--json now adds "Accept": "application/json" to GET requests if no previous Accept header exists. 2012-04-14 14:13:53 -05:00
Jakub Roztocil
0c4c6c4753 Added --auth-type and tests for basic/digest auth.
Closes #38.
2012-04-11 13:56:25 +02:00
Jakub Roztocil
51aa0409e6 Added Python 3 support
Closes #11.
2012-03-15 00:13:11 +01:00
Jakub Roztocil
6a1f0248e1 Fixed tests. 2012-03-14 19:21:47 +01:00
Jakub Roztocil
b7e0473d6c Added file upload support
It is now possible to send multipart/form-data requests.

Note that the --file option used previously has been removed
because it didn't allow you specify the field name.

Example:

    http -f POST example.com field-name@/path/to/file
2012-03-14 19:14:37 +01:00