File tree 1 file changed +9
-9
lines changed
1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -194,15 +194,15 @@ def rewrite_links(link_header):
194
194
</api/issues?per_page=50&page=2>; rel="next",
195
195
</api/issues?per_page=50&page=4>; rel="last" etc.
196
196
'''
197
- links = link_header . split ( ',' )
198
- new_links = []
199
- for link in links :
200
- api_path , endpoint_path = link .rsplit ('/' , 1 )
201
- if api_path .strip ().startswith ('< https://api.github.com/repositories' ):
202
- new_links . append ( endpoint_path .replace ('issues?' , '< /api/issues?' ) )
203
- if api_path .strip ().startswith ('< https://api.github.com/search' ):
204
- new_links . append ( endpoint_path .replace ('issues?' , '< /api/issues/search?' ) )
205
- return ', ' . join ( new_links )
197
+ header_link_data = parse_link_header ( link_header )
198
+ for data in header_link_data :
199
+ uri = data [ 'link' ]
200
+ api_path , endpoint_path = uri .rsplit ('/' , 1 )
201
+ if api_path .strip ().startswith ('https://api.github.com/repositories' ):
202
+ data [ 'link' ] = endpoint_path .replace ('issues?' , '/api/issues?' )
203
+ if api_path .strip ().startswith ('https://api.github.com/search' ):
204
+ data [ 'link' ] = endpoint_path .replace ('issues?' , '/api/issues/search?' )
205
+ return format_link_header ( header_link_data )
206
206
207
207
208
208
def sanitize_link (link_header ):
You can’t perform that action at this time.
0 commit comments