json

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package json contains helper methods to handler requests and responses more easily.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadRequest

func ReadRequest(req *http.Request, payload interface{}) error

ReadRequest validates the request headers and decodes into the provided payload.

func ValidateAcceptHeader

func ValidateAcceptHeader(req *http.Request) error

ValidateAcceptHeader checks that the accept header instruction allows for JSON handling.

func WriteResponse

func WriteResponse(w http.ResponseWriter, status int, payload interface{}) error

WriteResponse validates the request headers and encodes the provided payload into the response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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