From df23d41813a8249b7731d4e5b889b79daf0e1717 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 5 Aug 2013 16:24:08 +0400 Subject: [PATCH] Github: accept null as custom headers --- .../jetbrains/plugins/github/api/GithubApiUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java b/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java index cb5ba3bac36f..107476f56160 100644 --- a/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java +++ b/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java @@ -84,7 +84,7 @@ public class GithubApiUtil { private static ResponsePage request(@NotNull GithubAuthData auth, @NotNull String path, @Nullable String requestBody, - @NotNull Collection
headers, + @Nullable Collection
headers, @NotNull HttpVerb verb) throws IOException { HttpMethod method = null; try { @@ -128,7 +128,7 @@ public class GithubApiUtil { private static HttpMethod doREST(@NotNull final GithubAuthData auth, @NotNull String path, @Nullable final String requestBody, - @NotNull final Collection
headers, + @Nullable final Collection
headers, @NotNull final HttpVerb verb) throws IOException { HttpClient client = getHttpClient(auth.getBasicAuth()); String uri = GithubUrlUtil.getApiUrl(auth.getHost()) + path; @@ -160,8 +160,10 @@ public class GithubApiUtil { if (tokenAuth != null) { method.addRequestHeader("Authorization", "token " + tokenAuth.getToken()); } - for (Header header : headers) { - method.addRequestHeader(header); + if (headers != null) { + for (Header header : headers) { + method.addRequestHeader(header); + } } return method; }