DEV Community

Cover image for HttpStatusDogs is published! 🐢
Michael Fomenko
Michael Fomenko

Posted on • Edited on

HttpStatusDogs is published! 🐢

A few years back I wrote a simple Spring Boot starter that adds a header to your HTTP responses with a link to the appropriate HTTP status dog. The pet project (pun intended) was inspired by Mike Lee's project httpstatusdogs.com

Today I released it on Maven Central! πŸ₯³

Usage

You can start using it just by adding it to your dependency list like this for Gradle:

implementation 'dev.fomenko:httpstatusdogs:1.0.0'
Enter fullscreen mode Exit fullscreen mode

or for Maven:

<dependency>
    <groupId>dev.fomenko</groupId>
    <artifactId>httpstatusdogs</artifactId>
    <version>1.0.0</version>
 </dependency> 
Enter fullscreen mode Exit fullscreen mode

So now, for any endpoint, you'll have a HttpStatusDog header.

Example

Here's an example of a Spring controller

  @RestControllerclass FakeController {
         @GetMapping("/404")
         public String method404(HttpServletResponse response) {
              response.setStatus(404);
              return "Test";
         }
  }
Enter fullscreen mode Exit fullscreen mode

and the response it provides:

HTTP/1.1 404 
StatusDog: https://httpstatusdogs.com/img/404.jpg
Content-Type: text/plain;charset=UTF-8
Content-Length: 5
Date: Fri, 13 May 2022 20:42:44 GMT

Test
Enter fullscreen mode Exit fullscreen mode

You can find the code on my GitHub: https://github.com/michaelfmnkhttpstatusdogs
Maven Central: https://search.maven.org/artifact/dev.fomenko/httpstatusdogs/1.0.0/jar

P.S: For me, this lib is an attempt at releasing my own library. I'm planning on releasing my other projects soon.

Top comments (0)