Skip to content

Commit 43632c2

Browse files
committed
Original code supported setting accept type to json (or other
supported type) by including an extension in the url. So .../issue.json would return json and .../issue.xml would return xml response (if xml response were supported). This code strips the extension from the uri one it has been processed.
1 parent 7067f74 commit 43632c2

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ Features:
4646
- Patches to new rest code:
4747
- Generated links in responses should use the base url specified
4848
in config.ini.
49+
- allow user (e.g. in browser) to override response type/Accept
50+
header using extension in url. E.G. .../issues.json. This fixes
51+
the existing code so it works.
4952
(John Rouillard)
5053
- issue2550833: the export_csv web action now returns labels/names
5154
rather than id's. Replace calls to export_csv with the export_csv_id

roundup/rest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,11 @@ def dispatch(self, method, uri, input):
11261126
ext_type = os.path.splitext(urlparse(uri).path)[1][1:]
11271127
data_type = ext_type or accept_type or self.__default_accept_type
11281128

1129+
if ( ext_type ):
1130+
# strip extension so uri make sense
1131+
.../issue.json -> .../issue
1132+
uri = uri[:-( len(ext_type) + 1 )]
1133+
11291134
# check for pretty print
11301135
try:
11311136
pretty_output = input['pretty'].value.lower() == "true"

0 commit comments

Comments
 (0)