Commit Graph

321 Commits

Author SHA1 Message Date
Jakub Roztocil
5a1bd4ba83 Cleanup 2016-11-23 23:15:18 +01:00
Jakub Roztocil
3f7ed35238 Add more plugin API tests 2016-11-23 23:09:45 +01:00
Jakub Roztocil
54a63a810e Cleanup/docstring 2016-11-23 22:29:36 +01:00
Jakub Roztocil
a49774d3ab Extend auth plugin API
This extends the `AuthPlugin` API by the following attributes:

* `auth_require`: set to `False` to make `--auth, -a` optional
* `auth_parse`: set to `False` to disable `username:password` parsing
  (access the raw value passed to `-a` via `self.raw_auth`).
* `prompt_password`: set to`False` to disable password prompt when
   no password provided (only relevant when `auth_parse == True`)

 These changes should be 100% backwards-compatible.

 What needs more testing is auth support in sessions.

Close #433
Close #431
Close #378
Ping teracyhq/httpie-jwt-auth#3
2016-11-23 22:02:12 +01:00
Jakub Roztocil
b879d38b07 Test case for Host header removal (unimplemented feature) 2016-11-23 22:02:12 +01:00
Jakub Roztocil
6267f21f21 Clean-up 2016-10-26 11:58:47 +02:00
Jakub Roztocil
9b23a4ac9a Exit with status 130 on CTRL-C
http://www.tldp.org/LDP/abs/html/exitcodes.html

 #531
2016-10-26 11:53:01 +02:00
Jakub Roztocil
b96eba336d Fixed test 2016-10-26 11:28:17 +02:00
Jakub Roztocil
48a6d234cb Need a main()
#531
2016-10-26 11:21:30 +02:00
Pedro Rodrigues
8f6bee9196 codestyle fixes 2016-07-19 17:23:40 +01:00
Jakub Roztocil
49a0fb6e0f More liberal default JSON Accept header
Closes #470
2016-07-02 14:18:36 +02:00
Jakub Roztocil
1124d68946 Added --default-scheme <URL_SCHEME>
Closes #289
2016-07-02 12:47:02 +02:00
Jakub Roztocil
c8e06b55e1 Fix tests 2016-07-02 12:03:19 +02:00
Jakub Roztocil
5acbc904b7 Added the ability to unset headers
Closes #476
2016-07-02 11:50:30 +02:00
Jakub Roztocil
098257c0be Rename --print-others to --history-print. 2016-07-01 18:49:27 +02:00
Jakub Roztocil
5300b0b490 Fixed #451 - OSError: [Errno 36] File name too long 2016-03-17 15:58:01 +08:00
Jakub Roztocil
35a99fe04b Added test for -F shortcut 2016-03-09 21:58:34 +08:00
Jakub Roztocil
76e15b227c Added test_verbose_implies_all 2016-03-09 21:58:11 +08:00
Jakub Roztocil
25d1e8e418 Add Accept-Encoding: identity for --download
#423
2016-03-07 11:46:59 +08:00
Jakub Roztocil
6e1dbadff9 Replace --show-redirects with --all and add --print-others, -P
With --all, any intermediary requests/responses are shown (such as redirects
 or the initial unauthorized Digest auth request).

 The --print-others, -P option works like --print, -p, but only applies to
 intermediary requests/responses. The default behaviour is to inherit
 the value of -p.
2016-03-07 07:04:23 +08:00
Jakub Roztocil
a6ebc44a48 Run tests against both HTTP and HTTPS
Some of the tests now use the `httpbin_both` fixture from pytest-httpbin.
Also, made httpbin's CA trusted by default and added `httpbin_secure_untrusted`
fixture  to allow overriding that for particular tests.
2016-03-06 17:42:35 +08:00
Jakub Roztocil
bb49a1f979 Improved --debug output 2016-03-05 01:42:48 +08:00
Jakub Roztocil
4e574e6b8e Cleanup tests 2016-03-03 18:50:18 +08:00
Jakub Roztocil
5bdf4a3bae Fixed test_rst_file_syntax error message 2016-03-03 17:22:12 +08:00
Jakub Roztocil
20823c1702 Removed the "implicit_content_type" config option
If you used:

    "implicit_content_type": "form"

 You can achieve the the same result with:

     "default_options": ["--form"]

If you used:

    "implicit_content_type": "json"

 Then it's the default behaviour and it can be removed.

 In either case HTTPie will migrate your config file on the next invocation.
2016-03-03 17:14:39 +08:00
Jakub Roztocil
5dbd104c3b Nobody ain't got time for that 2016-03-03 17:09:34 +08:00
Jakub Roztocil
d24f30d0af Cleanup 2016-03-02 13:31:23 +08:00
Jakub Roztocil
66e168b2af Improved failed test output 2016-03-02 13:16:41 +08:00
Jakub Roztocil
dc4da527db Added --ssl=<PROTOCOL_VERSION>
Closes #98
2016-03-02 12:12:05 +08:00
Jakub Roztocil
38e8ef14ec Run positive tests first
Trying to debug failing SSL tests on Travis - kevin1024/pytest-httpbin#32
2016-03-02 10:35:40 +08:00
Jakub Roztocil
f6824f7ade Cleanup 2016-03-02 02:53:23 +08:00
Jakub Roztocil
7fd46e0b0d Cleanup 2016-03-02 01:02:11 +08:00
Jakub Roztocil
d4067fcb6d Added a short timeout for test requests 2016-03-02 00:31:00 +08:00
Jakub Roztocil
56afd1adb9 Test suite cleanup 2016-03-01 23:22:50 +08:00
Jakub Roztocil
5e87a2d7e5 Cleanup 2016-03-01 23:13:45 +08:00
Jakub Roztocil
d30e28c2c7 Test suite improvements 2016-03-01 23:11:06 +08:00
Jakub Roztocil
2a25d71aa4 Refactored main() into program() + main() 2016-03-01 21:10:54 +08:00
Jakub Roztocil
01ca7f0eb2 Ignore redirected stdout with --output, -o
This makes it easier to use HTTPie in cron jobs and scripts.

Closes #259
2016-03-01 20:24:50 +08:00
Jakub Roztocil
74e4d0b678 Added JSON detection when `--json, -j` is set
To correctly format JSON responses even when an incorrect ``Content-Type`` is returned.

Closes #92
Closes #349
Closes #368
2016-03-01 14:57:15 +08:00
Jakub Roztocil
ed08ab133e Refactoring 2016-02-29 15:00:17 +08:00
Jakub Roztocil
5408fb0fb9 Cleanup 2016-02-29 14:31:27 +08:00
Jakub Roztocil
e18b609ef7 Fixed --max-redirects 2016-02-29 14:21:25 +08:00
Jakub Roztocil
356e043651 Added --show-redirects and --max-redirects
Closes #157, #183, #188, #246
2016-02-29 14:12:09 +08:00
Jakub Roztočil
25f0156502 Merge pull request #432 from hangtwenty/master
Add `-A` as short arg for `--auth-type`
2016-02-28 20:58:23 +08:00
Jakub Roztocil
0f8d04b4df More robust mime type parsing
Closes #344
2016-02-28 20:12:16 +08:00
Jakub Roztocil
1127557742 Cleanup 2016-02-28 19:15:35 +08:00
Jakub Roztocil
5898879395 Fixed --download with --session
Closes #412
2016-02-28 19:14:10 +08:00
Jakub Roztocil
8c33e5e3d3 Parser => HTTPieArgumentParser 2016-02-28 19:01:54 +08:00
Jakub Roztocil
56f498c153 Detect Content Type of file uploaded in multipart/form-data request
Closes #271 #285 #398

This adds filename-based detection. It's still not possible to specify the
content type manually, though.
2016-02-28 15:49:01 +08:00
Michael Floering
deb7b747cc Small fix for Python 2.6 compatibility.
Relates to #430 / #432.
2016-01-22 18:46:36 -06:00
Michael Floering
018e1f68de Merge remote-tracking branch 'upstream/master' 2016-01-22 18:40:53 -06:00
Michael Floering
ac69d4311b add -A as short arg for --auth-type
Addresses #430
comes with unit test
2016-01-22 18:37:30 -06:00
Jakub Roztocil
84b81c00ea Fixed tox.ini and improved tests and CONTRIBUTING.txt 2016-01-02 14:07:00 -03:00
Luis San Martin
45df860124 PEP8 errors 2015-10-22 14:32:16 -03:00
Jakub Roztocil
2b51cb6687 Updated links II. 2015-07-03 18:55:45 +02:00
Jakub Roztočil
cbbaac13ea Merge pull request #300 from msabramo/print_info_about_request_on_error
Print info about request on error
2015-03-25 22:21:18 +01:00
Marc Abramowitz
f855de16c2 Increase test coverage for error handling 2015-02-15 23:22:52 -08:00
Marc Abramowitz
51c19cfe10 test_ssl.py: Remove skip failures on PyPy
Revert 985f65e which skipped SSL tests that failed on PyPy because @kevin1024 fixed the problem in pytest-httpbin 0.0.6 (commit f38a312446)
2015-02-15 21:42:34 -08:00
Jakub Roztocil
985f65ef52 Temporarily skip SSL tests on PyPy due to #308 2015-02-14 23:14:06 +01:00
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