httputils

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2023 License: MIT Imports: 6 Imported by: 0

README

httputils

Package httputils contains assorted HTTP-related functionality.

Documentation

Overview

Package httputils contains assorted HTTP-related functionality.

Index

Constants

View Source
const (
	AuthorizationHeader    = "Authorization"
	ContentTypeHeader      = "Content-Type"
	ContentTypeJSON        = "application/json"
	ContentTypeJSONUTF8    = "application/json;charset=utf-8"
	ContentTypeProblemJSON = "application/problem+json"
)

HTTP header constants.

Variables

This section is empty.

Functions

func ConsumeAndCloseResponseBody

func ConsumeAndCloseResponseBody(r *http.Response)

ConsumeAndCloseResponseBody discards any remaining contents in an HTTP response body and closes it.

func VerifyRequestContentType

func VerifyRequestContentType(r *http.Request, t string) error

VerifyRequestContentType returns an error if the media type in the HTTP response Content-Type header, excluding any parameters, does not match the provided media type.

func VerifyResponseContentType

func VerifyResponseContentType(r *http.Response, t string) error

VerifyResponseContentType returns an error if the media type in the HTTP response Content-Type header, excluding any parameters, does not match the provided media type.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL