Skip to content

Commit

Permalink
API Key Not Being Passed On Paged Requests (Azure#23477)
Browse files Browse the repository at this point in the history
* fix for pagination bug in async calls

* changelog

* update recordings

* update changelog
  • Loading branch information
kashifkhan authored and rakshith91 committed Apr 7, 2022
1 parent a7df8de commit 0d8ca1a
Show file tree
Hide file tree
Showing 6 changed files with 3,664 additions and 71 deletions.
1 change: 1 addition & 0 deletions sdk/search/azure-search-documents/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### Breaking Changes

### Bugs Fixed
- Fixed issue where async `search` call would fail with a 403 error when retrieving large number of documents.

### Other Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async def _get_next_cb(self, continuation_token):
_next_link, next_page_request = unpack_continuation_token(continuation_token)

return await self._client.documents.search_post(
search_request=next_page_request
search_request=next_page_request, **self._kwargs
)

async def _extract_data_cb(self, response): # pylint:disable=no-self-use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,18 @@ async def _test_suggest(self, client):
{"hotelId": "2", "text": "Cheapest hotel in town. Infact, a motel."},
{"hotelId": "9", "text": "Secret Point Motel"},
]

@SearchEnvVarPreparer()
@search_decorator(schema="hotel_schema.json", index_batch="hotel_large.json")
@recorded_by_proxy_async
async def test_search_client_large(self, endpoint, api_key, index_name):
client = SearchClient(endpoint, index_name, api_key)
async with client:
await self._test_get_search_simple_large(client)

async def _test_get_search_simple_large(self, client):
results = []
async for x in await client.search(search_text = ''):
results.append(x)
assert len(results) == 60

Loading

0 comments on commit 0d8ca1a

Please sign in to comment.