Skip to content

Conversation

@tanmaykm
Copy link
Member

This introduces a way to choose between different HTTP libraries while instantiating an OpenAPI client. Maintains OpenAPI API and models compatibility, though the HTTP library specific return values (raw response, errors and such) would be as per the chosen library.

  • New HTTP client library abstraction: Created an interface contract for HTTP client libraries (httplibs.jl, julialang_downloads.jl, juliaweb_http.jl)
  • Modularized client code: Moved client types and chunk readers into dedicated modules (clienttypes.jl, chunk_readers.jl)
  • Client libraries support:
    • Default: Downloads.jl
    • Optional: HTTP.jl via new httplib parameter

Enables future backend additions without major refactoring. Maintains backward compatibility (Downloads.jl is default).

Example:

client = Client("http://api.example.com/")

client = Client("http://api.example.com/"; httplib=OpenAPI.HTTPLib.HTTP)

api = MyGeneratedApi(client)
result, http_resp = get_resource(api, 123)

@info "Status: $(http_resp.status)"
@info "Headers: $(http_resp.headers)"

raw_response = http_resp.raw  # HTTP.Response or Downloads.Response

Also added a simple stress testing suite for client. Useful to compare the two http client libraries supported now.

This introduces a way to choose between different HTTP libraries while instantiating an OpenAPI client. Maintains OpenAPI API and models compatibility, though the HTTP library specific return values (raw response, errors and such) would be as per the chosen library.

- New HTTP client library abstraction: Created an interface contract for HTTP client libraries (`httplibs.jl`, `julialang_downloads.jl`, `juliaweb_http.jl`)
- Modularized client code: Moved client types and chunk readers into dedicated modules (`clienttypes.jl`, `chunk_readers.jl`)
- Client libraries support:
    - Default: Downloads.jl
    - Optional: HTTP.jl via new `httplib` parameter

Enables future backend additions without major refactoring. Maintains backward compatibility (Downloads.jl is default).

Example:

```julia
client = Client("http://api.example.com")

client = Client("http://api.example.com"; httplib=OpenAPI.HTTPLib.HTTP)

api = MyGeneratedApi(client)
result, http_resp = get_resource(api, 123)

@info "Status: $(http_resp.status)"
@info "Headers: $(http_resp.headers)"

raw_response = http_resp.raw  # HTTP.Response or Downloads.Response
```
Useful to compare different http client libraries
@tanmaykm tanmaykm marked this pull request as ready for review January 23, 2026 04:21
@tanmaykm
Copy link
Member Author

I seems ready to me... can merge in some time

@tanmaykm tanmaykm merged commit f553a42 into main Jan 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants