I want to check the header of the request whether it contains a certain header or not before continuing with the body. For example, I want to check whether a multipart/form-data
That's the limitation of HTTP. You can't send a response when the request hasn't been read fully to end.