swagger-api / swagger-api/swagger-codegen

[Retrofit2 + Play! WS client ] Add headers

Open
#6,980 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I am not able to set custom headers from the ApiClient class.

Swagger-codegen version

2.3.0-SNAPSHOT

Suggest a fix/enhancement

Wouldn't be a good idea to have something like this?

Map<String, List<String>> headers = new HashMap<>();
//fill the map with your headers
ApiClient generatedClient = new ApiClient(client)
                .setBasePath(basePath)
                .setHeaders(headers);

BalanceApi api = generatedClient.createService(BalanceApi.class);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Java ApiClient implementation used with Retrofit2 and Play WS, then trace createService and how request headers are assembled. Check any generated-client tests or examples; done means a caller can provide a map of custom headers through ApiClient and those headers reach requests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.