mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
Merge branch 'master' into basic-auth
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
HttpBin is written and maintained by Kenneth Reitz and
|
||||
various contributors:
|
||||
|
||||
Development Lead
|
||||
````````````````
|
||||
|
||||
- Kenneth Reitz <_@kennethreitz.com>
|
||||
|
||||
|
||||
Patches and Suggestions
|
||||
```````````````````````
|
||||
|
||||
- Zbigniew Siciarz
|
||||
@@ -15,13 +15,13 @@ httpbin(1): HTTP Client Testing Service
|
||||
`/status/:code` Returns given HTTP Status code.
|
||||
`/redirect/:n` 302 Redirects *n* times.
|
||||
`/cookies` Returns cookie data.
|
||||
`/set-cookie/:name/:value` Sets a simple cookie.
|
||||
`/cookies/set/:name/:value` Sets a simple cookie.
|
||||
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
Testing an HTTP Library can become difficult sometimes. PostBin.org is fantastic
|
||||
for testing POST requests, but not much else. This exists to cover all kinds of HTTP
|
||||
for testing POST requests, but not much else. This exists to cover all kinds of HTTP
|
||||
scenarios. Additional endpoints are being considered: `/basic-auth`, `/deflate`, *&c*.
|
||||
|
||||
All endpoint responses are JSON-encoded.
|
||||
|
||||
+5
-5
@@ -183,17 +183,17 @@ def view_status_code(code):
|
||||
def view_cookies():
|
||||
"""Returns cookie data."""
|
||||
|
||||
return request.cookies
|
||||
return dict(cookies=request.cookies)
|
||||
|
||||
|
||||
@app.route('/set-cookie/<name>/<value>')
|
||||
@app.route('/cookies/set/<name>/<value>')
|
||||
def set_cookie(name, value):
|
||||
"""Sets a cookie and redirects to cookie list."""
|
||||
|
||||
response = app.make_response(redirect('/cookies'))
|
||||
response.set_cookie(key=name, value=value)
|
||||
r = app.make_response(redirect('/cookies'))
|
||||
r.set_cookie(key=name, value=value)
|
||||
|
||||
return response
|
||||
return r
|
||||
|
||||
|
||||
@app.route('/basic-auth')
|
||||
|
||||
Reference in New Issue
Block a user