A minimal Kotlin and Spring Boot application for
testing HTTP PATCH.
Since the standard JDK HTTP library does not support HTTP PATCH
by default, Spring must be able to locate a ClientHttpRequestFactory that does support HTTP PATCH.
Spring autoconfigures it's RestTemplateBuilder, and if either HttpComponentsClientHttpRequestFactory
or OkHttp3ClientHttpRequestFactory are found, they will be used, and they do provided the necessary support
for HTTP PATCH.
Run the downstream backend with:
# Assuming project root is the current directory.
scripts/json-server start data/books.json Call the application, listening on port 9000, with:
# Fetch all books
curl -s -X GET http://localhost:9000/books
# Update a book
curl -s http://localhost:9000/books/3 \
-H "Content-Type: application/json" \
--data '{"author": "New Author", "title": "New Title"}'Remove implementation("com.squareup.okhttp3:okhttp:4.10.0") from the build.gradle.kts to get this application to fail
on the update call.
- A working Docker environment.