Skip to content
Permalink
Browse files

[FIXED JENKINS-16918] Use HTTP 405 when POST is required.

(cherry picked from commit ec9d809)

Conflicts:
	changelog.html
  • Loading branch information
jglick authored and olivergondza committed Aug 9, 2013
1 parent f664639 commit d7e370236249a05a01fcb929da8593eac4cc4340
@@ -31,6 +31,7 @@
import org.kohsuke.stapler.StaplerResponse;

import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import jenkins.security.ApiTokenProperty;
import org.acegisecurity.AccessDeniedException;
import org.kohsuke.stapler.HttpResponses;
@@ -84,6 +85,8 @@ public static void checkPermission(AbstractProject project, BuildAuthorizationTo
return;
}

rsp.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
rsp.addHeader("Allow", "POST");
throw HttpResponses.forwardToView(project, "requirePOST.jelly");
}

@@ -262,7 +262,7 @@ public void testDoEval() throws Exception {
jenkins.setCrumbIssuer(null);
WebClient wc = createWebClient();
wc.login("alice");
wc.assertFails("eval", HttpURLConnection.HTTP_INTERNAL_ERROR);
wc.assertFails("eval", HttpURLConnection.HTTP_BAD_METHOD);
assertEquals("3", eval(wc));
wc.login("bob");
try {

0 comments on commit d7e3702

Please sign in to comment.
You can’t perform that action at this time.