reader

package
v0.0.0-...-6cd7eb2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndGetBody

func CheckAndGetBody(w http.ResponseWriter, r *http.Request, indentJSON bool) []byte

CheckAndGetBody checks if the request body is not nil and tries to read it in a byte slice when an error occurs an error will be send back using the ResponseWriter

func CheckContentType

func CheckContentType(w http.ResponseWriter, r *http.Request, indentJSON bool) bool

CheckContentType checks if there is a content-type header, if so check if it is of type application/json, if not return an error, SensorThings server only accepts application/json

func GetEntityID

func GetEntityID(r *http.Request) string

GetEntityID retrieves the id from the request, for example the request http://mysensor.com/V1.0/Things(1236532) returns 1236532 as id

func ParseEntity

func ParseEntity(entity entities.Entity, data []byte) error

ParseEntity tries to convert the byte data into the given interface of type entity if an error returns it will be wraped inside an gosterror

Types

This section is empty.

Jump to

Keyboard shortcuts

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