Skip to content

Commit b0a55c7

Browse files
iscai-msftiscai-msft
andauthored
[python] pass headers kwarg to next requests in paging calls (#10328)
fixes #10313 --------- Co-authored-by: iscai-msft <isabellavcai@gmail.com>
1 parent 2d28766 commit b0a55c7

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
Pass `headers` kwarg through to next requests in paging calls

cspell.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ words:
129129
- jsyaml
130130
- keyer
131131
- killpg
132+
- kwarg
132133
- kwargs
133134
- labelledby
134135
- libc

packages/http-client-python/generator/pygen/codegen/serializers/builder_serializer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,8 @@ def call_next_link_request_builder(self, builder: PagingOperationType) -> list[s
13531353
except StopIteration:
13541354
pass
13551355

1356-
retval.append(f'_request = HttpRequest("{builder.next_link_verb}", {next_link_str}{query_str})')
1356+
header_str = ", headers=_headers"
1357+
retval.append(f'_request = HttpRequest("{builder.next_link_verb}", {next_link_str}{header_str}{query_str})')
13571358
retval.extend(self._postprocess_http_request(builder, "_request.url"))
13581359

13591360
return retval

0 commit comments

Comments
 (0)