Closed dzikoysk closed 2 years ago
Oh, that's quite funny, because it looks like HttpMethod
stores everything that have been requested:
@Test
void weirdVerbs() {
Unirest.request("CHEESE", MockServer.CHEESE)
.asObject(RequestCapture.class)
.getBody()
.assertMethod(HttpMethod.valueOf("CHEESE"))
.assertBody("");
}
Results later in:
Error:
HttpMethodTest.shouldReturnAllMethods:51
expected: <[PATCH, GET, OPTIONS, DELETE, POST, PUT, TRACE, HEAD]>
but was: <[PATCH, CHEESE, GET, OPTIONS, DELETE, POST, PUT, TRACE, HEAD]>
It looks like custom methods are considered as a feature, so what do you think about extending HttpMethod
with a property canonic
/standard
, so we can differ those methods? Or we can just remove this test if the registry it meant to keep non-standard values for the whole jvm instance.
I'd just change the test to:
assertEquals(HttpMethod.GET.all(), HttpMethod.all());
You could also check that it contains the default (but might have more which is fine).
but yes, there re some systems with custom methods. mostly old
439