url 中的问题点
problematic dot in url
我得到了一个 url 参数,其中包含 3 个名为 token 的点。假设它是 'boo.foo.joo'。
我的控制器应该处理请求的方法只需要前两部分('boo.foo')。但是我可以在 request.response_ext
中看到剩余部分。
response_ext
是什么?这种行为是来自我的网络框架还是通用惯例?
from tg import request
def recover_password(self, token):
print(token) # outputs > 'boo.foo'
print(request.response_ext) # outputs > '.joo'
It's a feature of your framework :
base_config.disable_request_extensions – by default this is false.
This means that TG will take the request, and strip anything off the
end of the last element in the URL that follows ”.”. It will then take
this information, and assign an appropriate mime-type and store the
data in the tg.request.response_type and tg.request.response_ext
variables. By enabling this flag, you disable this behavior, rendering
TG unable to determine the mime-type that the user is requesting
automatically.
在您的情况下,您可能希望将其设置为 true 以禁用此行为。
我得到了一个 url 参数,其中包含 3 个名为 token 的点。假设它是 'boo.foo.joo'。
我的控制器应该处理请求的方法只需要前两部分('boo.foo')。但是我可以在 request.response_ext
中看到剩余部分。
response_ext
是什么?这种行为是来自我的网络框架还是通用惯例?
from tg import request
def recover_password(self, token):
print(token) # outputs > 'boo.foo'
print(request.response_ext) # outputs > '.joo'
It's a feature of your framework :
base_config.disable_request_extensions – by default this is false. This means that TG will take the request, and strip anything off the end of the last element in the URL that follows ”.”. It will then take this information, and assign an appropriate mime-type and store the data in the tg.request.response_type and tg.request.response_ext variables. By enabling this flag, you disable this behavior, rendering TG unable to determine the mime-type that the user is requesting automatically.
在您的情况下,您可能希望将其设置为 true 以禁用此行为。