@@ -71,6 +71,7 @@ def notModified(self):
71
71
def fail (
72
72
self ,
73
73
content : str | None = None ,
74
+ * ,
74
75
status : int = 500 ,
75
76
contentType : str = "text/plain" ,
76
77
):
@@ -87,8 +88,10 @@ def redirect(self, url: str, permanent: bool = False):
87
88
def returns (
88
89
self ,
89
90
value : Any ,
90
- contentType : str = "application/json" ,
91
91
headers : dict [str , str ] | None = None ,
92
+ * ,
93
+ status : int = 200 ,
94
+ contentType : str = "application/json" ,
92
95
):
93
96
if isinstance (value , bytes ):
94
97
try :
@@ -101,18 +104,25 @@ def returns(
101
104
contentType = contentType ,
102
105
contentLength = len (payload ),
103
106
headers = headers ,
107
+ status = status ,
104
108
)
105
109
106
110
def respondText (
107
- self , content : str | bytes | Iterator [str | bytes ], contentType = "text/plain"
111
+ self ,
112
+ content : str | bytes | Iterator [str | bytes ],
113
+ contentType = "text/plain" ,
114
+ status : int = 200 ,
108
115
):
109
- return self .respond (content = content , contentType = contentType )
116
+ return self .respond (content = content , contentType = contentType , status = status )
110
117
111
- def respondHTML (self , html : str | bytes | Iterator [str | bytes ]):
112
- return self .respond (content = html , contentType = "text/html" )
118
+ def respondHTML (self , html : str | bytes | Iterator [str | bytes ], status : int = 200 ):
119
+ return self .respond (content = html , contentType = "text/html" , status = status )
113
120
114
121
def respondFile (
115
- self , path : Path | str , status : int = 200 , headers : dict [str , str ] | None = None
122
+ self ,
123
+ path : Path | str ,
124
+ headers : dict [str , str ] | None = None ,
125
+ status : int = 200 ,
116
126
):
117
127
# TODO: We should have a much more detailed file handling, supporting ranges, etags, etc.
118
128
p : Path = path if isinstance (path , Path ) else Path (path )
@@ -128,8 +138,9 @@ def respondFile(
128
138
def respondError (
129
139
self ,
130
140
content : str | None = None ,
131
- status : int = 500 ,
132
141
contentType : str = "text/plain" ,
142
+ * ,
143
+ status : int = 500 ,
133
144
):
134
145
return self .error (status , content , contentType )
135
146
0 commit comments