Skip to content

Commit 8e81981

Browse files
committed
adding dev-v0.11.13 tag to this commit to ensure building
1 parent 9d6ba2d commit 8e81981

File tree

2 files changed

+39
-136
lines changed

2 files changed

+39
-136
lines changed

html/supertokens_python/constants.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h1 class="title">Module <code>supertokens_python.constants</code></h1>
4040
# License for the specific language governing permissions and limitations
4141
# under the License.
4242
SUPPORTED_CDI_VERSIONS = [&#34;2.9&#34;, &#34;2.10&#34;, &#34;2.11&#34;, &#34;2.12&#34;, &#34;2.13&#34;, &#34;2.14&#34;, &#34;2.15&#34;]
43-
VERSION = &#34;0.11.12&#34;
43+
VERSION = &#34;0.11.13&#34;
4444
TELEMETRY = &#34;/telemetry&#34;
4545
USER_COUNT = &#34;/users/count&#34;
4646
USER_DELETE = &#34;/user/remove&#34;

html/supertokens_python/framework/flask/flask_response.html

Lines changed: 38 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ <h1 class="title">Module <code>supertokens_python.framework.flask.flask_response
5151
def __init__(self, response: Response):
5252
super().__init__({})
5353
self.response = response
54+
self.original = response
5455
self.headers: List[Any] = []
5556
self.response_sent = False
5657
self.status_set = False
@@ -72,53 +73,22 @@ <h1 class="title">Module <code>supertokens_python.framework.flask.flask_response
7273
httponly: bool = False,
7374
samesite: str = &#34;lax&#34;,
7475
):
75-
from werkzeug.http import dump_cookie
76-
77-
if self.response is None:
78-
cookie = dump_cookie(
79-
key,
80-
value=value,
81-
expires=int(expires / 1000),
82-
path=path,
83-
domain=domain,
84-
secure=secure,
85-
httponly=httponly,
86-
samesite=samesite,
87-
)
88-
self.headers.append((&#34;Set-Cookie&#34;, cookie))
89-
else:
90-
self.response.set_cookie(
91-
key,
92-
value=value,
93-
expires=expires / 1000,
94-
path=path,
95-
domain=domain,
96-
secure=secure,
97-
httponly=httponly,
98-
samesite=samesite,
99-
)
76+
self.response.set_cookie(
77+
key,
78+
value=value,
79+
expires=expires / 1000,
80+
path=path,
81+
domain=domain,
82+
secure=secure,
83+
httponly=httponly,
84+
samesite=samesite,
85+
)
10086

10187
def set_header(self, key: str, value: str):
102-
if self.response is None:
103-
# TODO in the future the headrs must be validated..
104-
# if not isinstance(value, str):
105-
# raise TypeError(&#34;Value should be unicode.&#34;)
106-
if &#34;\n&#34; in value or &#34;\r&#34; in value:
107-
raise ValueError(
108-
&#34;Detected newline in header value. This is &#34;
109-
&#34;a potential security problem&#34;
110-
)
111-
self.headers.append((key, value))
112-
else:
113-
self.response.headers.add(key, value)
88+
self.response.headers.add(key, value)
11489

11590
def get_header(self, key: str) -&gt; Union[None, str]:
116-
if self.response is not None:
117-
return self.response.headers.get(key)
118-
for value in self.headers:
119-
if value[0] == key:
120-
return value[1]
121-
return None
91+
return self.response.headers.get(key)
12292

12393
def set_status_code(self, status_code: int):
12494
if not self.status_set:
@@ -127,8 +97,6 @@ <h1 class="title">Module <code>supertokens_python.framework.flask.flask_response
12797
self.status_set = True
12898

12999
def get_headers(self):
130-
if self.response is None:
131-
return self.headers
132100
return self.response.headers
133101

134102
def set_json_content(self, content: Dict[str, Any]):
@@ -170,6 +138,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
170138
def __init__(self, response: Response):
171139
super().__init__({})
172140
self.response = response
141+
self.original = response
173142
self.headers: List[Any] = []
174143
self.response_sent = False
175144
self.status_set = False
@@ -191,53 +160,22 @@ <h2 class="section-title" id="header-classes">Classes</h2>
191160
httponly: bool = False,
192161
samesite: str = &#34;lax&#34;,
193162
):
194-
from werkzeug.http import dump_cookie
195-
196-
if self.response is None:
197-
cookie = dump_cookie(
198-
key,
199-
value=value,
200-
expires=int(expires / 1000),
201-
path=path,
202-
domain=domain,
203-
secure=secure,
204-
httponly=httponly,
205-
samesite=samesite,
206-
)
207-
self.headers.append((&#34;Set-Cookie&#34;, cookie))
208-
else:
209-
self.response.set_cookie(
210-
key,
211-
value=value,
212-
expires=expires / 1000,
213-
path=path,
214-
domain=domain,
215-
secure=secure,
216-
httponly=httponly,
217-
samesite=samesite,
218-
)
163+
self.response.set_cookie(
164+
key,
165+
value=value,
166+
expires=expires / 1000,
167+
path=path,
168+
domain=domain,
169+
secure=secure,
170+
httponly=httponly,
171+
samesite=samesite,
172+
)
219173

220174
def set_header(self, key: str, value: str):
221-
if self.response is None:
222-
# TODO in the future the headrs must be validated..
223-
# if not isinstance(value, str):
224-
# raise TypeError(&#34;Value should be unicode.&#34;)
225-
if &#34;\n&#34; in value or &#34;\r&#34; in value:
226-
raise ValueError(
227-
&#34;Detected newline in header value. This is &#34;
228-
&#34;a potential security problem&#34;
229-
)
230-
self.headers.append((key, value))
231-
else:
232-
self.response.headers.add(key, value)
175+
self.response.headers.add(key, value)
233176

234177
def get_header(self, key: str) -&gt; Union[None, str]:
235-
if self.response is not None:
236-
return self.response.headers.get(key)
237-
for value in self.headers:
238-
if value[0] == key:
239-
return value[1]
240-
return None
178+
return self.response.headers.get(key)
241179

242180
def set_status_code(self, status_code: int):
243181
if not self.status_set:
@@ -246,8 +184,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
246184
self.status_set = True
247185

248186
def get_headers(self):
249-
if self.response is None:
250-
return self.headers
251187
return self.response.headers
252188

253189
def set_json_content(self, content: Dict[str, Any]):
@@ -302,12 +238,7 @@ <h3>Methods</h3>
302238
<span>Expand source code</span>
303239
</summary>
304240
<pre><code class="python">def get_header(self, key: str) -&gt; Union[None, str]:
305-
if self.response is not None:
306-
return self.response.headers.get(key)
307-
for value in self.headers:
308-
if value[0] == key:
309-
return value[1]
310-
return None</code></pre>
241+
return self.response.headers.get(key)</code></pre>
311242
</details>
312243
</dd>
313244
<dt id="supertokens_python.framework.flask.flask_response.FlaskResponse.get_headers"><code class="name flex">
@@ -320,8 +251,6 @@ <h3>Methods</h3>
320251
<span>Expand source code</span>
321252
</summary>
322253
<pre><code class="python">def get_headers(self):
323-
if self.response is None:
324-
return self.headers
325254
return self.response.headers</code></pre>
326255
</details>
327256
</dd>
@@ -345,31 +274,16 @@ <h3>Methods</h3>
345274
httponly: bool = False,
346275
samesite: str = &#34;lax&#34;,
347276
):
348-
from werkzeug.http import dump_cookie
349-
350-
if self.response is None:
351-
cookie = dump_cookie(
352-
key,
353-
value=value,
354-
expires=int(expires / 1000),
355-
path=path,
356-
domain=domain,
357-
secure=secure,
358-
httponly=httponly,
359-
samesite=samesite,
360-
)
361-
self.headers.append((&#34;Set-Cookie&#34;, cookie))
362-
else:
363-
self.response.set_cookie(
364-
key,
365-
value=value,
366-
expires=expires / 1000,
367-
path=path,
368-
domain=domain,
369-
secure=secure,
370-
httponly=httponly,
371-
samesite=samesite,
372-
)</code></pre>
277+
self.response.set_cookie(
278+
key,
279+
value=value,
280+
expires=expires / 1000,
281+
path=path,
282+
domain=domain,
283+
secure=secure,
284+
httponly=httponly,
285+
samesite=samesite,
286+
)</code></pre>
373287
</details>
374288
</dd>
375289
<dt id="supertokens_python.framework.flask.flask_response.FlaskResponse.set_header"><code class="name flex">
@@ -382,18 +296,7 @@ <h3>Methods</h3>
382296
<span>Expand source code</span>
383297
</summary>
384298
<pre><code class="python">def set_header(self, key: str, value: str):
385-
if self.response is None:
386-
# TODO in the future the headrs must be validated..
387-
# if not isinstance(value, str):
388-
# raise TypeError(&#34;Value should be unicode.&#34;)
389-
if &#34;\n&#34; in value or &#34;\r&#34; in value:
390-
raise ValueError(
391-
&#34;Detected newline in header value. This is &#34;
392-
&#34;a potential security problem&#34;
393-
)
394-
self.headers.append((key, value))
395-
else:
396-
self.response.headers.add(key, value)</code></pre>
299+
self.response.headers.add(key, value)</code></pre>
397300
</details>
398301
</dd>
399302
<dt id="supertokens_python.framework.flask.flask_response.FlaskResponse.set_html_content"><code class="name flex">

0 commit comments

Comments
 (0)