Categorygithub.com/sylabs/json-resp
modulepackage
0.9.4
Repository: https://github.com/sylabs/json-resp.git
Documentation: pkg.go.dev

# README

JSON Response

PkgGoDev Build Status Code Coverage Go Report Card

The json-resp package contains a small set of functions that are used to marshall and unmarshall response data and errors in JSON format.

Go Version Compatibility

This module aims to maintain support for the two most recent stable versions of Go. This corresponds to the Go Release Maintenance Policy and Security Policy, ensuring critical bug fixes and security patches are available for all supported language versions.

# Functions

ReadError attempts to unmarshal JSON-encoded error details from the supplied reader.
ReadResponse reads a JSON response, and unmarshals the supplied data.
ReadResponsePage reads a paged JSON response, and unmarshals the supplied data.
WriteError writes a status code and JSON response containing the supplied error message and status code to w.
WriteResponse writes a status code and JSON response containing data to w.
WriteResponsePage writes a status code and JSON response containing data and pd to w.

# Structs

Error describes an error condition.
PageDetails specifies paging information.
Response is the top level container of all of our REST API responses.