Only change the method of requests that Jetty won't handle by default
Previously, JettyEmbeddedErrorHandler would change the method of every request that is handles to GET. This was being done to work around Jetty's error handling only dealing with GET, POST, and HEAD requests by default. It had the unwanted side-effect of causing an error response to a HEAD request having a body as, from the error handling's perspective, it was a GET request. This commit updates JettyEmbeddedErrorHandler to only set the method on a request for which error handling is being performed if the method isn't already one that will be handled, leaving the method of GET, POST, and HEAD requests unchanged. Unfortunately, short of implementing an HTTP client, this change cannot be tested as the Apache HttpClient, OkHttp, and the JDK's HttpURLConnection all silently drop the body of a response to a HEAD request, preventing a test from asserting that a body hasn't been sent. Closes gh-23551
Showing
Please register or sign in to comment