Commit Graph

243 Commits

Author SHA1 Message Date
Kenneth Reitz 54ad646067 merge 2.0 insto master 2013-09-24 14:13:28 -04:00
Kenneth Reitz 23ced527f7 Merge pull request #1503 from skastel/master
Fixing error return to be consistent with tuple return at the end of the method
2013-09-24 10:48:07 -07:00
Jon Parise b9b5be7c4c Improved content encoding detection.
get_encodings_from_content() can now detect HTML in-document content
encoding declarations in the following formats:

 - HTML5
 - HTML4
 - XHTML 1.x served with text/html MIME type
 - XHTML 1.x served as XML

Ref: http://www.w3.org/International/questions/qa-html-encoding-declarations
2013-09-03 16:16:46 -07:00
Cory Benfield f44b86e039 Allow non-string objects to be data with files 2013-08-17 07:27:58 +01:00
Stephen Huenneke b676bf3214 Fixing tests to verify thrown ValueError's. 2013-08-08 09:20:41 -07:00
Stephen Huenneke 9dd823c289 Raising ValueError's when we're passed inconsistent POST data and files dict. 2013-08-06 11:04:03 -07:00
Kenneth Reitz bd1f1404a0 Merge branch 'fix_401_cookies' of git://github.com/sigmavirus24/requests into 2.0 2013-07-31 21:33:24 -04:00
Kenneth Reitz 1a6637c285 Merge branch 'keytype' of git://github.com/Lukasa/requests into 2.0 2013-07-31 21:25:57 -04:00
Kenneth Reitz d5fd3d3331 Merge pull request #1487 from dpursehouse/rewrite-test_mixed_case_scheme_acceptable
Rewrite test cases to remove dependency on httpbin.org and example.com
2013-07-31 18:23:34 -07:00
Robert Estelle 0ab7a52f7c Merge settings when creating PreparedRequest, don't copy Request. 2013-07-31 13:42:02 -07:00
Robert Estelle 0eccb547a2 Add Session.prepare_request test case. 2013-07-30 23:02:13 -07:00
Robert Estelle d4385f6fc8 Add Request.copy() test case. 2013-07-30 23:01:56 -07:00
Cory Benfield ec2859c0de Modify new CID tests to use native string keys. 2013-07-29 14:52:44 +01:00
Cory Benfield f5775594cc Header keys should be native strings.
This commit follows a discussion on IRC. For more information, see the
Pull Request associated with it.
2013-07-29 14:52:44 +01:00
Ian Cordasco 972089826e Fixed finally. Also requires updated httpbin.org 2013-07-27 23:07:25 -04:00
Ian Ross and Ian Cordasco 73635df1b2 Start work on sending cookies back
On 401's the cookies received aren't sent back to the server. See: #1336
2013-07-27 23:07:25 -04:00
David Pursehouse 82c9aa912e Check the response URL in test_uppercase_scheme_redirect
Update the test to check that the URL in the response is the
one that we expect, i.e. the one it was supposed to redirect to.
2013-07-24 17:37:35 +09:00
David Pursehouse 56b5f02551 Rewrite test_uppercase_scheme_redirect to use local httpbin
Instead of redirecting to hard-coded 'example.com', use the URL
defined in `HTTPBIN_URL` with the path set to the 'html' endpoint.
2013-07-24 17:18:16 +09:00
David Pursehouse c4f16c351c Remove redundant test case test_uppercase_scheme
This test verifies that an upper case scheme ('HTTP') works correctly,
but this is already tested in `test_mixed_case_scheme_acceptable`.
2013-07-24 16:58:09 +09:00
David Pursehouse 012cc33d44 Rewrite test_mixed_case_scheme_acceptable to work with local httpbin
Instead of using hard-coded urls to httpbin.org, use the url defined
in `HTTPBIN_URL` replacing the scheme as necessary to test the mixed
cases.

Refs #1485
2013-07-24 16:36:10 +09:00
David Pursehouse 415fb53cb4 Remove redundant session in test_mixed_case_scheme_acceptable 2013-07-24 12:15:46 +09:00
Ian Cordasco c0cb698191 Derp. Use compat 2013-07-23 10:48:45 -05:00
Ian Cordasco d2176cf052 Use urlparse.urljointo construct httpbin url 2013-07-23 10:24:30 -05:00
Kenneth Reitz f71bff1226 Merge pull request #1482 from dpursehouse/fix-testcases-with-proxy
Fix test cases that fail when running behind a proxy
2013-07-23 05:23:35 -07:00
David Pursehouse 9e771aa79c Fix test cases that fail when running behind a proxy
When sending a request via `Session.send()` the proxies must be
explicitly given with the `proxies` argument.  This is not done
in the test cases, which means that they fail when run on a system
that is behind a proxy.

Update test cases to make sure the proxies are set in the sessions.
2013-07-23 16:55:27 +09:00
David Pursehouse 29db7b7216 Test cases fail when HTTPBIN_URL does not have trailing slash
Test cases can be run against a local httpbin server defined by
the `HTTPBIN_URL` environment variable, but it causes tests to
fail if the given URL does not end with a slash.

Ensure that the URL always ends with a slash.
2013-07-23 15:29:36 +09:00
Kenneth Reitz 65a0fd88a9 Merge pull request #1440 from fcurella/patch-0
unquote double-quotes cookie values
2013-07-15 06:54:00 -07:00
Flavio Curella a8cf5b8502 keep the double quotes, but don't escape them 2013-07-01 15:48:48 -05:00
Flavio Curella cdab4fabf4 unquote double-quotes cookie values 2013-07-01 13:51:40 -05:00
Vikram Oberoi d9c49ad30d Add test to verify .netrc authentication behavior.
Here's what should happen:

- If no credentials are given, use netrc if there's a netrc entry.
- If credentials are given, they should override netrc.
2013-06-27 17:16:42 -04:00
Roman Haritonov 716b627c1e Don't reuse PreparedRequest on redirects 2013-06-08 14:41:34 +04:00
Roman Haritonov 798a1ffdec new failing test_requests_in_history_are_not_overridden() 2013-06-08 14:41:34 +04:00
Kenneth Reitz 8430e6ccbb Merge pull request #1334 from rcarz/master
resolve_redirects no longer throws an InvalidSchema exception when the scheme is uppercase
2013-06-08 03:18:25 -07:00
Bob Carroll 2c5ea69e5d rebased with upstream/master 2013-05-26 14:46:36 -07:00
Bob Carroll d59510481a this didn't merge properly 2013-05-26 14:45:49 -07:00
Bob Carroll f3036adc4f added assertion to test_uppercase_scheme_redirect for the response code 2013-05-26 14:44:37 -07:00
Bob Carroll 72e155e529 resolve_redirects now checks for a scheme before converting the scheme to lowercase, added tests or the scheme casing 2013-05-26 14:44:22 -07:00
Viktor Haag 01993d21dc added tests for mixed-case scheme URLs, changed adapters passing down URLs into urllib3 by lower-ifying them so that the underlying pool manager can effectively pool by scheme as dictionary key 2013-05-24 16:14:14 -04:00
Viktor Haag 5e94f38001 - fixed func call syntax on lower to lower()
- added test cases for trying to test GETS on mixed-case schemas
2013-05-24 14:01:30 -04:00
papaeye 2a34335dc3 Fix #1374 2013-05-22 04:30:19 +09:00
papaeye 715a57dec8 Fix typo, %t -> %r 2013-05-22 02:20:51 +09:00
Ib Lundgren 003c795afe Only pass unicode fieldnames to urllib3. 2013-05-21 09:46:28 +01:00
Chase Sterling 98114245c6 Refactor merge_kwargs for clarity and to fix a few bugs 2013-05-20 21:20:51 -04:00
Dave Shawley 6e76ab7188 Fix for #1362.
`PreparedRequest.prepare_url` incorrectly applied IDNA encoding to the
URLs entire `netloc`.  It should only be encoding the hostname portion
of the URL.  IDNA encoding was limiting the user info, host, and port
segments to be a maximum of 63 characters which causes problems for
all by the most trivial user + password combinations.

- Replaced usage of `urlparse` in `PreparedRequest.prepare_url` with
  `urllib3` equivalent.
- Modified IDNA encoding section so that it only encodes the host
  portion of the URL.
2013-05-16 13:12:34 -04:00
Łukasz Langa 4c8af1fff4 Fixes #1320: transport adapters stored in ordered form 2013-05-15 13:34:09 +02:00
Colin Dunklau f93275c47f Minor update to tests, added docstrings
Requested by @sigmavirus24.
2013-05-01 12:51:09 -05:00
Colin Dunklau f7596c75dc Rewrite CaseInsensitiveDict to work correctly/sanely
Fixes #649 and #1329 by making Session.headers a CaseInsensitiveDict,
and fixing the implementation of CID. Credit for the brilliant idea
to map `lowercased_key -> (cased_key, mapped_value)` goes to
@gazpachoking, thanks a bunch.

Changes from original implementation of CaseInsensitiveDict:

1.  CID is rewritten as a subclass of `collections.MutableMapping`.
2.  CID remembers the case of the last-set key, but `__setitem__`
    and `__delitem__` will handle keys without respect to case.
3.  CID returns the key case as remembered for the `keys`, `items`,
    and `__iter__` methods.
4.  Query operations (`__getitem__` and `__contains__`) are done in
    a case-insensitive manner: `cid['foo']` and `cid['FOO']` will
    return the same value.
5.  The constructor as well as `update` and `__eq__` have undefined
    behavior when given multiple keys that have the same `lower()`.
6.  The new method `lower_items` is like `iteritems`, but keys are
    all lowercased.
7.  CID raises `KeyError` for `__getitem__` as normal dicts do. The
    old implementation returned
6.  The `__repr__` now makes it obvious that it's not a normal dict.

See PR #1333 for the discussions that lead up to this implementation
2013-04-30 14:52:27 -05:00
Chase Sterling a7fef58756 Add another session cookie test 2013-04-25 23:11:43 -04:00
Chase Sterling 3ff8d43801 Fix cookielib import 2013-04-25 22:40:24 -04:00
Chase Sterling 1866f7596e Add test for session cookiejars other than RequestsCookieJar 2013-04-25 22:32:03 -04:00