Commit acdeb17
committed
fix: if Content-Type header defined, don't overwrite with default
When processing a template, you should be able to set the content-type
header using:
tal:replace="python:request.client.additional_headers.update(
{'Content-Type':'application/vnd.roundup.translation+json'}
)"
The client used to always overwrite it with the content type derived
from the template extension or text/html for unknown extensions. This
patch stops the overwriting if the Content-Type is already set in the
header.
This particular use case was to use an XML document to process a url
like:
/tracker?@template=translation+json&tokens=Login,Welcome+%s
and get back json data of the translated strings. If the file was
named '_generic.json' and we used '@template=json' we got
application/json returned. For other template names we got text/html.1 parent 95c49cf commit acdeb17
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2132 | 2132 | | |
2133 | 2133 | | |
2134 | 2134 | | |
2135 | | - | |
| 2135 | + | |
| 2136 | + | |
2136 | 2137 | | |
2137 | 2138 | | |
2138 | 2139 | | |
| |||
0 commit comments