Skip to content

Commit

Permalink
Skip the interceptor for MediaType.MULTIPART_FORM_DATA (apache#9217)
Browse files Browse the repository at this point in the history
Skip the interceptor for `MediaType.MULTIPART_FORM_DATA`
  • Loading branch information
codelipenghui authored Jan 18, 2021
1 parent b019c4b commit 93b2239
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo
servletRequest.getServletContext().getContextPath(),
servletRequest.getContentType());
}
if (MediaType.MULTIPART_FORM_DATA.equalsIgnoreCase(servletRequest.getContentType())) {
if (MediaType.MULTIPART_FORM_DATA.equalsIgnoreCase(servletRequest.getContentType())
|| MediaType.APPLICATION_OCTET_STREAM.equalsIgnoreCase(servletRequest.getContentType())) {
// skip multipart request at this moment
filterChain.doFilter(servletRequest, servletResponse);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response.Status;
import org.apache.pulsar.broker.PulsarService;
import org.apache.pulsar.broker.intercept.BrokerInterceptor;
Expand Down Expand Up @@ -63,7 +64,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
/* connection is already invalidated */
}
}
if (interceptorEnabled) {
if (interceptorEnabled && !MediaType.MULTIPART_FORM_DATA.equalsIgnoreCase(request.getContentType())
&& !MediaType.APPLICATION_OCTET_STREAM.equalsIgnoreCase(request.getContentType())) {
interceptor.onWebserviceResponse(request, response);
}
}
Expand Down

0 comments on commit 93b2239

Please sign in to comment.