jsonutil

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package jsonutil provides common utilities for properly handling JSON payloads in HTTP body.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasContentType

func HasContentType(r *http.Request, mimetype string) bool

check for valid content type.

func Unmarshal

func Unmarshal(r *http.Request, data []byte, v interface{}) (int, error)

Unmarshal provides a common implementation of JSON unmarshalling with well defined error handling. Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. If v is nil or not a pointer, Unmarshal returns an InvalidUnmarshalError. It can unmarshal data available in request/data param.

Types

This section is empty.

Jump to

Keyboard shortcuts

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