cors-filter icon indicating copy to clipboard operation
cors-filter copied to clipboard

POST without Content-Type -> INVALID_CORS correct?

Open upachler opened this issue 6 years ago • 0 comments

I'm using version 1.0.1, which rejects a POST request without Content-Type (because there is no content) as requestType=INVALID_CORS.

This is because the if()-block in CORSFilter.java#631 has no else branch:

                        if (contentType != null) {
                            contentType = contentType.toLowerCase().trim();
                            if (SIMPLE_HTTP_REQUEST_CONTENT_TYPE_VALUES
                                    .contains(contentType)) {
                                requestType = CORSRequestType.SIMPLE;
                            } else {
                                requestType = CORSRequestType.ACTUAL;
                            }
                        }

wouldn't it be correct to add...

                        } else { // contentType == null
                                requestType = CORSRequestType.ACTUAL;
                        }

... so that POST requests without Content-Type are ACTUAL rather than INVALID_CORS?

upachler avatar Jul 27 '18 15:07 upachler