jenkinsci / jenkinsci/java-client-api

Job.build(Map<String, String> params) results in HTTP 414 (URI too long)

Ouverte
#352 4 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
913
Forks
466
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I've had problems with requests for a parameterized job build:

```
org.apache.http.client.HttpResponseException: Request-URI Too Long
at com.offbytwo.jenkins.client.validator.HttpResponseValidator.validateResponse(HttpResponseValidator.java:11)
at com.offbytwo.jenkins.client.JenkinsHttpClient.post(JenkinsHttpClient.java:232)
at com.offbytwo.jenkins.model.Job.build(Job.java:125)
at com.offbytwo.jenkins.model.Job.build(Job.java:112)
```

Looking at the code, I noticed that `Job.build` encodes the job parameter/values in the URL.
This can result in a very long URL that exceeds the server's max URL size.

I worked around this problem outside of the library by submitting a POST request where the job parameter/values are passed as form data instead of encoded in the url.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Start in Job.java at the parameterized Job.build overloads and follow the request into JenkinsHttpClient.post. Check how parameter names and values are currently encoded, then compare that with the reported form-data workaround. Done means parameterized builds use a request representation that avoids HTTP 414 for long values while preserving the parameters.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
api
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.