我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用werkzeug.exceptions.HTTPException.get_headers()。
def get_headers(self, environ=None): """Get a list of headers.""" return [('Content-Type', 'text/html')]
def get_response(self, environ=None): """Get a response object. If one was passed to the exception it's returned directly. :param environ: the optional environ for the request. This can be used to modify the response depending on how the request looked like. :return: a :class:`Response` object or a subclass thereof. """ if self.response is not None: return self.response if environ is not None: environ = _get_environ(environ) headers = self.get_headers(environ) return Response(self.get_body(environ), self.code, headers)
def get_headers(self, environ): headers = HTTPException.get_headers(self, environ) if self.valid_methods: headers.append(('Allow', ', '.join(self.valid_methods))) return headers
def get_headers(self, environ): headers = HTTPException.get_headers(self, environ) if self.length is not None: headers.append( ('Content-Range', '%s */%d' % (self.units, self.length))) return headers