swagger-api / swagger-api/swagger-codegen
[R] ApiClient defaultHeaderParams are ignored
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Here is the constructor for ApiClient:
initialize = function(basePath, configuration, defaultHeaders){
...
if (!missing(defaultHeaders)) {
self$defaultHeaders <- defaultHeaders
}
...
},
defaultHeaders are not referenced anywhere else in the R code.
Swagger-codegen version
swagger-codegen-cli-2.4.0-20180821.200234-311
Swagger declaration file content or url
Any file, e.g. petstore
Command line used for generation
java -jar swagger-codegen-cli-2.4.0-20180821.200234-311.jar generate --lang r -i swagger.yaml
Steps to reproduce
apic <- ApiClient$new("http://localhost:4200", NULL, c('Content-Type' = "application/json"))
PetApi$new(apic)$getPetById(123)
Observe the lack of any headers in the request.
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/issues/6520
Suggest a fix/enhancement
Merge this with the user-specified headers before sending the request, e.g. in ApiClient$callApi
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the R ApiClient constructor and ApiClient$callApi mentioned in the issue, then run the PetApi reproduction using the supplied Content-Type header. Trace how defaultHeaders and user-specified headers reach the request. Done means the generated R client sends the constructor's default header when calling getPetById.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100