Skip to content

Commit

Permalink
refactor: introduce constant for the JSESSIONID cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouffard committed Dec 13, 2019
1 parent ece39ce commit 68950f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/com/cdancy/jenkins/rest/JenkinsConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class JenkinsConstants {

public static final String OPTIONAL_FOLDER_PATH_PARAM = "optionalFolderPath";

public static final String JENKINS_COOKIES_JSESSIONID = "JSESSIONID";

protected JenkinsConstants() {
throw new UnsupportedOperationException("Purposefully not implemented");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package com.cdancy.jenkins.rest.parsers;

import static com.cdancy.jenkins.rest.JenkinsConstants.JENKINS_COOKIES_JSESSIONID;

import com.cdancy.jenkins.rest.domain.crumb.Crumb;

import com.google.common.base.Function;
Expand Down Expand Up @@ -55,7 +57,7 @@ private static String crumbValue(HttpResponse input) throws IOException {

private static String sessionIdCookie(HttpResponse input) {
return input.getHeaders().get(HttpHeaders.SET_COOKIE).stream()
.filter(c -> c.startsWith("JSESSIONID"))
.filter(c -> c.startsWith(JENKINS_COOKIES_JSESSIONID))
.findFirst()
.orElse("");
}
Expand Down

0 comments on commit 68950f6

Please sign in to comment.