Releasing a set of test cases for Content Negotiation
This post's featured URL for sharing metadata is https://www.jvt.me/img/profile.jpg.
As I've written about in the past, I'm a big fan of using Server-Driven Content Negotiation for APIs for versioning, but also find it handy for being able to serve different representations of data depending on what the client supports. This is handy to be able to serve an HTML page to a browser doing a form-post, compared to JSON to an API client doing the same call.
However - and something I'm going to write about further in the future - is that doing it right is hard. Not only in how you implement the negotiation algorithm itself, but also making sure that all parts of your HTTP stack, including things like middleware, are aware of the different representations.
While writing a Go library for content negotation, I found that the Java library I wrote early last year was actually missing some cases and functionality, and needed to be fixed.
Because I want to make sure that I've got a separate record of the expected cases, as well as being able to help others building tools around content negotiation I've ended up creating a new repo, content-negotiation-test-cases.
I've validated that my Go library and my Java library are now compliant with these cases for consistency.
I'll be looking to improve test cases, and see if there are clashes with well-known and supported frameworks.