73 Commits

Author SHA1 Message Date
Brett Randall 59526b0915 Revert "Support show_env param in /headers", reverting #457. Fixed #487.
The docstring typo fixes are retained, along with the additional tests,
modified to revert to the original "headers": { dict format.

The reverted change get_dict('headers') -> get_headers() was not required. The
query-string ?show_env=1 was already effective in allowing env headers to be
returned.

This partially reverts commit 31ffe79981.
2018-07-25 12:38:39 +10:00
Steffen Schröder 4db88dfa55 Added test to make sure index (/) will render correctly (to prevent #484) 2018-07-06 22:09:32 +02:00
kennethreitz ee15d0e5ec Merge pull request #457 from sanketsaurav/454-fix-headers-view
Fix #454: Support `show_env` param in `/headers`
2018-07-04 11:09:47 -04:00
Helen Kosova 4dcfa3d47d Fixed incorrect Bearer token extraction and added tests 2018-05-24 20:38:29 +03:00
Sanket Saurav 31ffe79981 Support show_env param in /headers
If `show_env` is True, then return all the headers without stripping `ENV_HEADERS`. This fixes #454.

Signed-off-by: Sanket Saurav <sanketsaurav@gmail.com>
2018-05-19 21:27:29 +05:30
kennethreitz a8c8e69659 disable tests for tracking
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
2018-05-17 19:44:01 -04:00
Jeroen Bogers a154cd1512 Return ETag header with 304 response
RFC 7232, section 4.1 specifies that when returning a 304 status code the
ETag header must also be included if it would have been sent in a 200 (OK)
response.
2018-03-20 14:12:06 +01:00
Nate Prewitt 82d7408267 send digest-auth challenge if wrong authorization type sent 2018-01-31 23:47:52 -08:00
Nate Prewitt 75c83178c1 Remove test for empty Content-Type
Werkzeug 14.0.0 introduced new behaviour stripping falsey
values from being included in EnvironHeaders.
2018-01-28 18:59:44 -08:00
Brett Randall 9e9cb84724 Added support for chunked encoded requests when running gunicorn. Fixed #340.
In this commit:

- when we see a Transfer-Encoding: chunked request, and the server is gunicorn,
  we set environ wsgi.input_terminated, which is required by Werkzeug in the
  absence of Content-Lenght, or it will empty the data stream.
- for chunked requests to non-gunicorn, return 501 Not Implemented.
2017-12-01 09:06:50 +11:00
David Poole f0f3da7b52 add SHA-512 authentication 2017-11-19 08:42:09 -07:00
Marek Ruszczak 84edf61ad6 Split and strip qop. 2017-07-09 19:26:01 +02:00
Marek Ruszczak 477721960c Add test for wrong password and expired (reused) nonce value 2017-07-08 11:27:26 +02:00
Marek Ruszczak 7e8015237d Add test to verify „stale after” scenario 2017-07-08 10:59:21 +02:00
Marek Ruszczak 0c968cbd35 Refactor digest_auth test to be able add missing test cases in next commits 2017-07-06 23:24:44 +02:00
David D Lowe df3f0501a3 Add /anything route 2017-06-01 18:53:18 +01:00
mwarren 4706888b3d add POST to methods kwarg
and a test, for good measure
2017-05-26 07:34:46 -04:00
Mike Mattozzi 7061616db8 Adding an etag URL for testing If-Match and If-None-Match logic 2017-04-22 16:26:09 -04:00
Nate Prewitt b64036b316 fix Content-Length header value for /range endpoint 2017-03-30 10:32:11 -06:00
kennethreitz 47093ca934 no google analytics 2017-03-17 13:16:52 -04:00
kennethreitz 36c68180d0 Merge pull request #254 from Lukasa/brotli
Add a Brotli endpoint.
2017-03-16 20:21:26 -04:00
kennethreitz 341ddcc471 Merge pull request #312 from felixpalta/Runscope-GH-296-fix-drip-with-zero-numbytes
Fix error 500 on drip due to division by zero (issue #296)
2017-03-16 20:21:09 -04:00
kennethreitz 519196d5ab fix failing test 2017-03-16 19:56:09 -04:00
Cory Benfield dfed4ad635 Add basic do-almost-nothing Brotli endpoint test 2017-03-15 08:43:42 +00:00
kennethreitz 65e6a05d0b Merge pull request #319 from puiterwijk/fix-response
Use Response.data with older Werkzeug versions
2017-03-14 17:10:56 -04:00
Tuomas Lappeteläinen 94e64b4598 status/code: return 400 on invalid status code
Request such as `/status/4!9` caused a `ValueError` exception when
trying to cast the status to an int. Now the client is greeted with
`400` and a body of `Invalid status code`.

Fixes #329.
2017-02-19 16:00:59 +02:00
Patrick Uiterwijk 512fbbd610 Use Response.data with older Werkzeug versions
Response.get_data did not exist in older versions of Flask/Werkzeug,
and is even now not documented.
This will make httpbin work with either the new version where it does
exist, and the older versions where it doesn't.

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
2016-12-30 21:07:48 +00:00
Felix Palta bba7dd8ee4 Add test for drip with invalid numbytes parameter 2016-12-04 23:46:00 +03:00
Felix Palta 45058da872 Minor refactoring of _test_digest_auth
Instead of joining encoded (binary) strings, join unicode strings first, then encode result, which leads to shorter and clearer code.
2016-12-04 21:31:52 +03:00
Felix Palta 562a60bc23 Update comments, minor fixes 2016-12-04 00:41:02 +03:00
Felix Palta ec17414e94 Enable test cases for Digest auth requests with or without body
When quality-of-protection (qop) is 'auth-int', the hash of request body is used to create digest response.
2016-12-04 00:25:42 +03:00
Felix Palta 9816125df3 Add test for different combinations of digest auth parameters 2016-12-04 00:17:03 +03:00
Felix Palta ada6bd1508 Check response status code in test_digest_auth_with_wrong_password() 2016-12-03 23:34:00 +03:00
Felix Palta f198dab947 Add test implementation for Digest authentication
It can be used for testing of all available combinations of qop (auth/auth-int/not specified) and algorithms (MD5, SHA-256).
2016-12-03 23:31:08 +03:00
Ian Cordasco 6f5d34f730 Merge branch 'master' of https://github.com/Jaaap/httpbin into digest-auth-sha256
Conflicts:
    httpbin/templates/httpbin.1.html
2016-08-10 19:47:51 -05:00
tzickel aea465074e Added supports for non-get redirect-to with other status_code (#284) 2016-08-10 06:20:18 -05:00
teijsden 82e67ed210 Made the Digest algorithm code backwards compatible with old URL style, /digest-auth/auth/user/passwd now works again 2015-11-06 13:48:12 +01:00
teijsden 14b7f46c71 Added support for another Digest algorithm, SHA256. 2015-11-04 15:30:01 +01:00
Florian Bruhin 6858420e24 Turn off tracking unless HTTPBIN_TRACKING is set.
Fixes #245.
2015-08-31 20:49:12 +02:00
David Shirley 60b0ada6f1 Fixed unit tests for python3.4 2015-02-19 11:41:43 -08:00
David Shirley 7e18da5ae9 Renamed endpoint /range-request -> /range 2015-01-26 13:51:47 -08:00
David Shirley e73f34e335 Added a /range-request endpoint
This endpoint conforms to RFC7233.
http://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7233.html

It is functionally very similar to /stream-bytes, but it also
allows specifying a "Range" header, which allows the client
to ask for a specific portion of the resource.

I didn't add this functionality to /stream-bytes so as not
to break compatibility with any clients that expect range
requests to fail on that endpoint. Perhaps I'm just being
overly cautious.
2015-01-02 13:22:42 -08:00
Eduardo Gurgel 54fc281ef7 Fix /redirect to return absolute URL 2014-12-23 19:31:44 +13:00
John Sheehan b16206b80a Merge pull request #184 from msabramo/travis
Add .travis.yml for Travis CI
2014-12-22 16:51:40 -08:00
Marc Abramowitz 6ad0781991 Fix Travis py34 failure
by not relying on core.pyc file in test
2014-12-22 16:37:07 -08:00
John Sheehan 5858e3d434 Merge branch 'GH-168' of https://github.com/msabramo/httpbin into msabramo-GH-168 2014-12-22 16:21:21 -08:00
John Sheehan 6930f8225d Merge pull request #160 from rictic/master
Send an explicit Content-Length header with /drip/
2014-12-22 16:19:10 -08:00
Marc Abramowitz 24dadf082c GH-168: Add newline to end of page
Fixes GH-168
2014-12-22 16:18:12 -08:00
John Sheehan 6dc5270b57 Merge pull request #158 from derflocki/wp-allow-headers
support Access-Control-Request-Headers
2014-12-22 16:15:05 -08:00
Marc Abramowitz 941033ddd2 GH-125: Support multiple headers with same key
Fixes: GH-125
2014-11-29 06:19:30 -08:00