Skip to content

Commit

Permalink
feat: slightly tweaking the body that is returned by the post request…
Browse files Browse the repository at this point in the history
… where next token and search params are not their own separat key value pairs but in the same body
  • Loading branch information
theodorehreuter committed Jan 24, 2025
1 parent 35c8f53 commit c148b7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/stapi_fastapi/routers/product_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ async def search_opportunities(
):
case Success((features, Some(pagination_token))):
links.append(self.order_link(request, "create-order"))
body = search.model_dump()
body["next"] = pagination_token
links.append(
Link(
href=str(
Expand All @@ -185,7 +187,7 @@ async def search_opportunities(
rel="next",
type=TYPE_JSON,
method="POST",
body={"next": pagination_token, "search": search},
body=body,
)
)
case Success((features, Nothing)): # noqa: F841
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def pagination_tester(
(d["href"] for d in resp_body["links"] if d["rel"] == "next"), None
)
body = next(
(d.get("body")["search"] for d in resp_body["links"] if d.get("body")),
(d.get("body") for d in resp_body["links"] if d.get("body")),
None,
)
else:
Expand Down

0 comments on commit c148b7d

Please sign in to comment.