mirror of
https://github.com/kennethreitz/httpbin.git
synced 2026-06-05 23:00:18 +00:00
Show proper scheme in urls
This commit is contained in:
+6
-2
@@ -6,7 +6,6 @@ httpbin.helpers
|
||||
|
||||
This module provides helper functions for httpbin.
|
||||
"""
|
||||
|
||||
import json
|
||||
from hashlib import md5
|
||||
from werkzeug.http import parse_authorization_header
|
||||
@@ -73,6 +72,11 @@ def get_headers(hide_env=True):
|
||||
return CaseInsensitiveDict(headers.items())
|
||||
|
||||
|
||||
def get_url():
|
||||
scheme = request.headers.get("X-Forwarded-Proto", "http")
|
||||
return request.url.replace("http", scheme)
|
||||
|
||||
|
||||
def get_dict(*keys, **extras):
|
||||
"""Returns request dict of given keys."""
|
||||
|
||||
@@ -102,7 +106,7 @@ def get_dict(*keys, **extras):
|
||||
|
||||
|
||||
d = dict(
|
||||
url=request.url,
|
||||
url=get_url(),
|
||||
args=request.args,
|
||||
form=form,
|
||||
data=data,
|
||||
|
||||
Reference in New Issue
Block a user