Skip to content

jaebradley/go-http-status-class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Report Card

go-http-status-class

Introduction

A very simple API that returns different HTTP Status Classes for various HTTP Status Codes (like Successful for http.StatusOK or ClientError for http.StatusBadRequest).

Usage

import (
  "net/http"

  "github.com/jaebradley/go-http-status-class"
)

var r http.Response;
r.StatusCode = http.StatusOK
statusClass := httpstatusclass.IdentifyResponseStatusClass(r)
fmt.Println(statusClass) // This should print "Successful"

statusClass2 := httpstatusclass.IdentifyStatusClass(-1)
fmt.Println(statusClass) // This should print "Unknown"

About

Get an HTTP Status Class from an HTTP Status Code

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages