@Override
    public HttpResponse handle(HttpRequest request) {
        try {
            switch (request.getMethod()) {
                case GET: return handleGET(request);
                case DELETE: return handleDELETE(request);
                case PUT: return handlePUT(request);
                default: return ErrorResponse.methodNotAllowed("Method '" + request.getMethod() + "' is not supported");
            }
        }
        catch (IllegalArgumentException e) {
            return ErrorResponse.badRequest(Exceptions.toMessageString(e));
        }
        catch (RuntimeException e) {
            log.log(Level.WARNING, "Unexpected error handling '" + request.getUri() + "'", e);
            return ErrorResponse.internalServerError(Exceptions.toMessageString(e));
        }
    }
@Test
    void testForcing() {
        assertTrue(handle(Method.PUT, "/data/" + new FlagId("undef"), "", 400).contains("There is no flag 'undef'"));

        assertTrue(handle(Method.PUT, "/data/" + new FlagId("undef") + "?force=true", "", 400).
                contains("No content to map due to end-of-input"));

        assertTrue(handle(Method.PUT, "/data/" + FLAG1.id(), "{}", 400).
                contains("Flag ID missing"));

        assertTrue(handle(Method.PUT, "/data/" + FLAG1.id(), "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 400).
                contains("Wrong type of JsonNode: STRING"));

        assertEquals(handle(Method.PUT, "/data/" + FLAG1.id() + "?force=true", "{\"id\": \"id1\",\"rules\": [{\"value\":\"string\"}]}", 200),
                "");
    }