Commit Graph

20 Commits

Author SHA1 Message Date
Kevin McCarthy 540b414490 Try to decode bytestrings from UTF8 in json_safe
Closes #148
2014-07-06 10:27:17 -10:00
Kevin McCarthy 320e994c30 Add Access-Control-Allow-Credentials to All
If you do a "simple" request, there will be no CORS preflight
OPTIONS request.  That means that Basic auth will fail over
CORS.  This adds the header to all requests, fixing the problem.

Closes #122
2014-06-21 15:51:24 -10:00
Kevin McCarthy f6d708ebe5 Check X-Forwarded-Proto when returning the url
Closes #31
2014-06-21 14:16:42 -10:00
Kevin McCarthy 5ee70566ec Fix Digest Auth to Return Correct Header
Digest Auth was returning the wrong header when a login attempt failed.

Closes #133
2014-06-21 13:58:36 -10:00
Kevin McCarthy f3f136581a pep8 cleanup on tests 2014-06-21 12:48:00 -10:00
Kevin McCarthy 745f9b5009 Add test for XML endpoint 2014-06-21 12:34:22 -10:00
Kevin McCarthy b2cb8678f3 Status Endpoint should Accept All HTTP Verbs
Closes #32 (again)
2014-06-21 12:16:00 -10:00
Kevin McCarthy 2593a8ab67 Add form and files to DELETE Endpoint
The DELETE endpoint was missing form and files, so if you hit the
endpoint with data in the envelope and a Content-Type header set to
application/x-www-form-urlencoded, the data will disappear.  Since RFC
2731 doesn't disallow content in the body of a DELETE request, let's
allow that data to pass through

Closes #143
2014-06-21 11:53:44 -10:00
Kevin McCarthy 0c44ec9233 Restore random seed function for byte endpoints
os.urandom() ignores random.seed(), so I'm restoring the use of
random.randint in a python3 compatible way.
2014-06-08 22:09:25 -10:00
Kevin McCarthy 7e2214ce14 fix byte streaming endpoint in python3 2014-06-08 17:49:58 -10:00
Kevin McCarthy 16d6fea9b8 Fix bytes endpoint in python3 2014-06-08 17:49:58 -10:00
Kevin McCarthy 32c842f06f Fix bug that was causing POSTs missing a content-type header to 500
Closes #141
2014-06-05 18:00:52 -10:00
Kevin McCarthy 782a3411a7 Add Python3 Support
I mostly just added a bunch of encoding, especially around the HTTP
Digest Auth stuff.  This commit also adds six as a dependency.
2014-05-25 19:44:07 -10:00
Rodrigo Chacon e3cd47d0e2 Use header Origin in response headers when available
Since the RFC [1] doesn't allow wildcards for credentialed requests,
add the requested Origin into the response headers.

[1] https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS#Requests_with_credentials
2013-04-24 19:33:18 -03:00
Rodrigo Chacon 50ddd78b89 PEP8 2013-04-24 19:33:18 -03:00
Rodrigo Chacon 11a8c78aa5 Adding support for preflight request headers
Just as stated in http://www.w3.org/TR/cors/#preflight-request, we must return some extra headers when dealing with preflight (HTTP OPTIONS method) requests.
2013-04-24 19:33:18 -03:00
Rodrigo Chacon 61bed33f24 Adding CORS support for all requests 2013-04-24 19:33:18 -03:00
Radomir Stevanovic 9a56bb8dd0 bugfix: JSON-safe encoding of raw binary data/files
Encoding of the received files and/or body data was failing in case of raw
binary data being POSTed/PUT/etc. (The exact trigger was actually a non-UTF-8
data stream, since Flask's `jsonify`, i.e. `simplejson.dumps` assumes UTF-8.)

Binary data in a JSON response are now encoded as "data" URLs, according to
RFC 2397. "Data" URL scheme was chosen for its simplicity and clarity. MIME
type is included. Plain text is passed thru unmodified, as before.

Also, tests demonstrating the bug/fix added to `test_httpbin.py`.
2012-08-14 22:57:35 +02:00
Radomir Stevanovic 213d03a090 init fixes (git, pip & test related)
- gitignored: *.pyc, env/
  - gevent added to requirements.txt
  - test_httpbin syntax error fix
2012-08-14 20:43:35 +02:00
Ori Livneh 52871e8301 base64-decoding endpoint + test 2011-12-20 00:26:14 -05:00