Closed adamkorynta closed 1 year ago
The problem comes down to Formats.parseHeader. That method is often used on the accept header but its also used on the ContentType for POST, PUT and UPDATE.
Maybe we shouldn't be reusing the method and should have a different method for ContentType ? Not sure.
Maybe we should be looking for charset explicitly and handling it somehow and if its been handled removing it from the ContentType string? Again, not sure.
Or, maybe Formats.parseHeader shouldn't be doing contentTypeList.contains(ct) but should be using some other method for finding a match in our list of supported ContentTypes.
It looks like our handling of asterisk in the ContentTypes isn't doing what I think asterisk is supposed to be doing.
Additional unit tests around Formats.parseHeader would probably help clarify what its doing and what it should be doing.
This will be fixed with #238, the same situation (but RestAssured instead of OkHttp) is happening. I've tweak the equals function to only care about the mimetype and version parameter.
I made a change to ContentType that may also have fixed this issue. Charset now gets handled on its own so it doesn't end up in the list of ContentType parameters.
Okay, I think I picked that up along with what I was doing. though I just realize that may particular issue wasn't in the ContentType class, is was string comparisons in ClobController.
But there can be other parameters so isolating to just the one ones we truly care about is probably the better thing to do.
I'm running into the following issue client side: https://github.com/square/okhttp/issues/2099, where I tell OkHttp to use
application/json;version=2
, but then the OkHttp client library converts this toapplication/json;version=2; charset=utf-8
.This ends up throwing the following exception server-side:
Reading this post (though I'm far from knowledge on the subject to vet the answer) this format looks valid: https://stackoverflow.com/questions/29549299/how-to-split-header-values