Skip to content

[QUERY] lambda in RequestContext #44875

Open
@weidongxu-microsoft

Description

@weidongxu-microsoft

Query/Question
RequestContext is composed of a sequence of Consumer<HttpRequest> requestCallback.

On "Paging: Query parameter re-injection (emitter work)" task, generated SDK is required to find e.g. a value of query queryParam on 1st HTTP GET page, and set the query parameter with that value in all subsequent paging calls.
(also, see test case Azure/typespec-azure#2497)

E.g., user start the paging with

GET /endpoint/page?query=value1

backend returns the values, with a {nextLinkUrl} without query, and SDK would need to continue with

GET {nextLinkUrl}&query=value1

Now, with all these Consumer<HttpRequest> requestCallback, it is very hard for SDK code to figure out which query parameter be set, and which value it sets, in 1st HTTP GET done by user.

Why is this not a Bug or a feature Request?
There may exists some workaround, e.g. add a last requestCallback to parse the URL and extract the query and value.

But apparently this is very tricky (the order of requestCallback matters) and hard to read (exact to an Atomic or mutable Map and write back in 2nd call?).

Setup (please complete the following information if applicable):

  • OS: [e.g. iOS]
  • IDE: [e.g. IntelliJ]
  • Library/Libraries: io.clientcore:core:1.0.0-beta.8

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Query Added
  • Setup information Added

Metadata

Metadata

Assignees

No one assigned

    Labels

    ClientThis issue points to a problem in the data-plane of the library.clientcore

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions