jenkinsci / jenkinsci/java-client-api

Enhancement: re-work crumbFlag handling

Open
#361 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
913
Forks
466
PR merge metrics
No merged PRs in 30d

Description

Currently the way to handle the crumbFlag is not very intuitive and even not complete. Some methods offer a parameter "crumbFlag" but other dont (see #350).

IMHO it would be better to handle this internally in the library or at least in one central place. So my suggestion is to have a new constructor:
`new JenkinsServer(..., boolean crumbFlag)`

Furthermore, if no crumbFlag is specified (by using the existing constructors) the library itself determines if the crumbFlag should be set or not by calling
```
String json = client.get("api/json");
boolean crumbFlag = new JsonObject(json).get("useCrumbs").getAsBoolean();
```

This would allow to cleanup the API from all overloaded methods that allow passing a "crumbFlag" parameter.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.