Commit Graph

215 Commits

Author SHA1 Message Date
Rajiv Mayani 8546a15587 The library raises NoneType error when file-pointer (fp) resolves to None.
>>> from requests import post
>>> r = post("https://example.com", files={"file-name": None})

However, when a param value or json field is None they are not included in the request body.

>>> from requests import get
>>> r = get("https://example.com", params={"file-name": None})
>>> r.request.url

This commit makes the beahviour consistent for files.
2018-05-17 13:56:17 -07:00
David Poole 85ec7d759e Merge branch 'master' into master 2018-03-05 09:07:12 -07:00
Nate Prewitt f60324a3de append previous url fragment on redirect 2018-01-21 09:55:45 -08:00
David Poole 1e46cbb4f0 add test for HTTP Digest auth algorithms SHA-256 and SHA-512 2017-11-29 07:10:57 -07:00
Nehal J Wani 9a8a826f22 Check if host is invalid for proxy
According to RFC3986, the authority section can be empty for a given URL,
however, for a proxy URL, it shouldn't be. This patch adds a check to verify
that the parsed URL will have a valid host before creating the proxy manager.

Fixes #4353
2017-11-15 08:58:54 -05:00
Alvaro Gutierrez Perez d165b18b6e Split test in two better-defined tests 2017-10-19 17:04:48 +02:00
Alvaro Gutierrez Perez e11989e8ec Add test for Session.get_adapter() prefix matching 2017-10-19 16:50:13 +02:00
Alvaro Gutierrez Perez af88af64e6 Add test for Session.get_adapter() case-insensitivity 2017-10-19 16:50:13 +02:00
kennethreitz 28ae74dbad update tests
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2017-09-17 11:46:33 -04:00
mgasvoda cbc7c2d1c9 Modifying tests to include header name info 2017-08-11 17:18:58 -04:00
Cory Benfield 8b3f20ca91 Add failing test for #4209 2017-07-29 12:09:04 +01:00
Felix Yan a0f0258eee Fix a typo: paramters -> parameters 2017-06-12 01:27:11 +08:00
Justin Mayhew c6a6347156 Remove exec permission from files that shouldn't have it 2017-06-10 20:38:45 -03:00
Ed Morley 4847f5b8cd Allow Requests.Response to be used as a context manager
This saves having to wrap the call to requests with
`contextlib.closing()`, allowing it to be used directly in a
`with` statement, like so:

```
with requests.get('http://httpbin.org/get', stream=True) as r:
    # Do things with the response here.
```

Fixes #4136.
2017-06-06 23:30:47 +01:00
kennethreitz 7f14db17c8 new requests namespace 2017-05-29 12:11:43 -04:00
kennethreitz 276024b170 fix tests 2017-05-27 19:33:40 -04:00
kennethreitz 4c155de9fd test entrypoints 2017-05-27 11:06:53 -04:00
kennethreitz af52bf795e remove bunk tests 2017-05-26 22:55:44 -04:00
kennethreitz 0bb200515c remove test imports from packages 2017-05-26 22:48:01 -04:00
Jonas Laursen af66521381 Fix #4025 2017-05-18 09:04:34 -07:00
Cory Benfield ddada2d750 We no longer downcase some hosts. 2017-05-09 10:08:06 +01:00
Alexander 'Leo' Bergolth 1be6a17edc oops! import Timeout as Urllib3Timeout 2017-04-03 16:49:46 +02:00
Alexander 'Leo' Bergolth 28768b945c use @pytest.mark.parametrize 2017-04-03 16:32:38 +02:00
Alexander 'Leo' Bergolth 93cb1ca763 add some tests for passing in Timeout objects 2017-04-02 15:20:29 +02:00
Bastien Gérard 4207867aaf PR review fixes:
- used httpbin_secure for tests
- updated docstring related to `verify` param"
- used TLS acronym instead of SSL
2017-03-22 21:28:38 +01:00
Bastien Gérard 7d8b87c37f #3926 raise IOError when providing an invalid path to a CA bundle or certificate files 2017-03-22 21:28:38 +01:00
Victor Pfautz 2aaf6ac038 Fixed some typos (#3892)
* Fixed some typos
2017-02-27 16:25:10 +00:00
Nate Prewitt f47aff68f1 properly handled failed seek 2017-02-14 07:45:41 -07:00
jonathan vanasco 70f31a3166 * initial attempt at get_redirect_target
* removing the `i` from the redirect detection while-loop
2017-02-10 13:53:23 -05:00
kennethreitz 97b5bc21d1 fix broken tests 2017-01-21 21:41:16 -05:00
winterJ e8c0a99cb1 Remove unused module 2017-01-11 18:20:52 +09:00
Ian Cordasco fae6701478 Add deprecation warnings for 3.0
Add extra test parameter for basic auth encoding
2016-12-09 08:43:54 -06:00
Nate Prewitt 576b447a37 adding string casting for non-bytes values 2016-12-08 21:13:14 -07:00
Nate Prewitt 13716728e7 minor doc string cleanup 2016-12-04 12:11:09 -07:00
Casey Davidson 14d71fd41a Test chunked upload doesn't set content length 2016-12-04 12:01:07 -07:00
Casey Davidson 2d2c831d07 Add tests to verify that correct 'Content-Length' or 'Transfer-Encoding' headers are being set in PreparedRequest. 2016-12-04 12:00:57 -07:00
Cory Benfield 6f659a4179 Tests for our URL handling. 2016-11-30 21:45:09 +00:00
Cory Benfield 402a55b647 Revert "Restrict URL preparation to HTTP/HTTPS"
This reverts commit 34af72c87d.
2016-11-30 21:19:31 +00:00
Cory Benfield 5c4549493b Merge pull request #3695 from nateprewitt/idna_bypass
idna bypass
2016-11-25 13:18:01 +00:00
Nicola Soranzo f897be58bf Make Response.content return None if raw is None
Add test.
2016-11-24 12:54:26 +00:00
Cory Benfield b9f1c448f7 Merge pull request #3673 from klimenko-forks/auth-unicode
Enable unicode in basic http auth
2016-11-21 19:27:39 +00:00
Dmitry Klimenko 005f93fd0f added new test, original test restored 2016-11-21 21:42:44 +03:00
Christian Heimes 34af72c87d Restrict URL preparation to HTTP/HTTPS
Requests treats all URLs starting with the string 'http' as HTTP URLs.
Preparation with IDNA breaks non-standard URIs like http+unix. Requests
now prepares only URLs with prefix http:// and https://.

Signed-off-by: Christian Heimes <christian@python.org>
2016-11-21 18:46:57 +01:00
Nate Prewitt d52e9b8c80 updated tests with IDNA encoded and IPv6 urls 2016-11-21 08:22:37 -07:00
Dmitry Klimenko 3b84be3c99 changed behavior of basic-http-auth test 2016-11-18 20:39:55 +03:00
Dmitry Klimenko e15280e49d fixed: httpbin with unicode auth 2016-11-18 19:04:51 +03:00
Dmitry Klimenko 55dea233ce fixed some error 2016-11-18 15:19:43 +03:00
Dmitry Klimenko 4f0efdb77e unicode test for _basic_auth_str 2016-11-18 13:31:31 +03:00
Dmitry Klimenko 7c4821231f Fixed: httpbin doesn't support bytes 2016-11-18 13:14:08 +03:00
Dmitry Klimenko bf3e960e15 fixed usage unicode string 2016-11-17 23:13:03 +03:00