Source:
public HttpServerRequest setExpectMultipart(boolean expect) { synchronized (conn) { checkEnded(); if (expect) { if (postRequestDecoder == null) { String contentType = headersMap.get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null) { io.netty.handler.codec.http.HttpMethod method = io.netty.handler.codec.http.HttpMethod.valueOf(rawMethod); String lowerCaseContentType = contentType.toString().toLowerCase(); boolean isURLEncoded = lowerCaseContentType.startsWith(HttpHeaderValues.APPLICATION_X_WWW_FORM_URLENCODED.toString()); if ((lowerCaseContentType.startsWith(HttpHeaderValues.MULTIPART_FORM_DATA.toString()) || isURLEncoded) && (method == io.netty.handler.codec.http.HttpMethod.POST || method == io.netty.handler.codec.http.HttpMethod.PUT || method == io.netty.handler.codec.http.HttpMethod.PATCH || method == io.netty.handler.codec.http.HttpMethod.DELETE)) { HttpRequest req = new DefaultHttpRequest( io.netty.handler.codec.http.HttpVersion.HTTP_1_1, method, uri); req.headers().add(HttpHeaderNames.CONTENT_TYPE, contentType); postRequestDecoder = new HttpPostRequestDecoder(new NettyFileUploadDataFactory(context, this, () -> uploadHandler), req); } else { throw new IllegalStateException("Invalid content type or http method. Content type should be "+HttpHeaderValues.MULTIPART_FORM_DATA.toString()+" or "+HttpHeaderValues.APPLICATION_X_WWW_FORM_URLENCODED+" and http method should be "+ io.netty.handler.codec.http.HttpMethod.POST.toString()+", " + io.netty.handler.codec.http.HttpMethod.PUT.toString() + ", "+ io.netty.handler.codec.http.HttpMethod.PATCH.toString()+" or "+io.netty.handler.codec.http.HttpMethod.DELETE.toString()+"."); } } else { throw new IllegalStateException("Content type must not be null."); } } } else { postRequestDecoder = null; } } return this; }

Target:
public HttpServerRequest setExpectMultipart(boolean expect) { synchronized (conn) { checkEnded(); if (expect) { if (postRequestDecoder == null) { String contentType = headersMap.get(HttpHeaderNames.CONTENT_TYPE); if (contentType != null) { io.netty.handler.codec.http.HttpMethod method = io.netty.handler.codec.http.HttpMethod.valueOf(rawMethod); String lowerCaseContentType = contentType.toString().toLowerCase(); boolean isURLEncoded = lowerCaseContentType.startsWith(HttpHeaderValues.APPLICATION_X_WWW_FORM_URLENCODED.toString()); if ((lowerCaseContentType.startsWith(HttpHeaderValues.MULTIPART_FORM_DATA.toString()) || isURLEncoded) && (method == io.netty.handler.codec.http.HttpMethod.POST || method == io.netty.handler.codec.http.HttpMethod.PUT || method == io.netty.handler.codec.http.HttpMethod.PATCH || method == io.netty.handler.codec.http.HttpMethod.DELETE)) { HttpRequest req = new DefaultHttpRequest( io.netty.handler.codec.http.HttpVersion.HTTP_1_1, method, uri); req.headers().add(HttpHeaderNames.CONTENT_TYPE, contentType); postRequestDecoder = new HttpPostRequestDecoder(new NettyFileUploadDataFactory(context, this, () -> uploadHandler), req); } else { throw new IllegalStateException("Invalid content type or http method. Content type should be multipart/form-data or application/x-www-form-urlencoded and http method should be POST, PUT, PATCH or DELETE."); } } else { throw new IllegalStateException("Content type must not be null."); } } } else { postRequestDecoder = null; } } return this; }