Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API functions shouldn't be mutating the optional headers= vector. #79

Open
NHDaly opened this issue Sep 27, 2022 · 1 comment
Open

API functions shouldn't be mutating the optional headers= vector. #79

NHDaly opened this issue Sep 27, 2022 · 1 comment

Comments

@NHDaly
Copy link
Member

NHDaly commented Sep 27, 2022

HTTP.jl mutates the supplied headers= vector in-place, to avoid allocations. But that optimization probably does not make sense at the scale of our API calls, and it's a surprising default behavior.

We should change this to manually copy the user-provided headers vector, before passing it to HTTP.jl:

julia> h = ["hello" => "world"]
1-element Vector{Pair{String, String}}:
 "hello" => "world"

julia> rsp = exec(ctx, "nhd-empty-4", "nhd-s", "", headers = h)
RAI.TransactionResponse({
                        "id": "f919be0f-6011-1b54-178e-56cf6468e538",
   "response_format_version": "2.0.4",
                     "state": "COMPLETED"
}, RAI.relationalai.protocol.MetadataInfo(RAI.relationalai.protocol.RelationMetadata[]), Union{}[], Pair{String, Arrow.Table}[])

julia> h
5-element Vector{Pair{String, String}}:
         "hello" => "world"
        "Accept" => "application/json"
  "Content-Type" => "application/json"
    "User-Agent" => "rai-sdk-julia/0.2.1"
@billscheidel-rai
Copy link

Note: This issue has been migrated to https://relationalai.atlassian.net/browse/RAI-7063.

This link is only accessible to employees of RelationalAI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants